Build error, no message

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phill

    Build error, no message

    I am getting a build error but it doesn't give me an
    error message. I know it has to do with the following
    line of code. What could be the problem and why don't I
    get an error message? Thanks.

    for (int i = 0; i <= detailView1.Ite ms.Count - 1; i++)
    {
    if (detailView1.It ems[i].GetType().ToSt ring().EndsWith
    ("ItemDateTime" ))
    {
    if advancedList1.S electedRow[detailView1.Ite ms
    [i].Name].ToString() <> ""

    detailView1.Ite ms[i].Value =
    advancedList1.S electedRow[detailView1.Ite ms[i].Name]
    else

    detailView1.Ite ms[i].Value =
    advancedList1.S electedRow[detailView1.Ite ms[i].Name]
    }
    {

    detailView1.Ite ms[i].Value =
    advancedList1.S electedRow[detailView1.Ite ms[i].Name];

    }
    }
  • Erik Frey

    #2
    Re: Build error, no message

    For starters, I see some "<>" that should be "!="

    "Phill" <anonymous@disc ussions.microso ft.com> wrote in message
    news:00e101c3ac 88$182b81a0$a50 1280a@phx.gbl.. .[color=blue]
    > I am getting a build error but it doesn't give me an
    > error message. I know it has to do with the following
    > line of code. What could be the problem and why don't I
    > get an error message? Thanks.
    >
    > for (int i = 0; i <= detailView1.Ite ms.Count - 1; i++)
    > {
    > if (detailView1.It ems[i].GetType().ToSt ring().EndsWith
    > ("ItemDateTime" ))
    > {
    > if advancedList1.S electedRow[detailView1.Ite ms
    > [i].Name].ToString() <> ""
    >
    > detailView1.Ite ms[i].Value =
    > advancedList1.S electedRow[detailView1.Ite ms[i].Name]
    > else
    >
    > detailView1.Ite ms[i].Value =
    > advancedList1.S electedRow[detailView1.Ite ms[i].Name]
    > }
    > {
    >
    > detailView1.Ite ms[i].Value =
    > advancedList1.S electedRow[detailView1.Ite ms[i].Name];
    >
    > }
    > }[/color]


    Comment

    • Bjorn Abelli

      #3
      Re: Build error, no message


      "Phill" wrote...[color=blue]
      > I am getting a build error but it doesn't give me an
      > error message. I know it has to do with the following
      > line of code. What could be the problem ...[/color]

      - Every if-expression must have
      parantheses around the condition.

      - All sentences must end with semicolon

      - In C# we use "!=" instead of "<>"

      // Bjorn A


      Comment

      • Phill

        #4
        Re: Build error, no message

        Thanks, but still not compiling. Where do I need to
        put ; I am a VB programmer converting to C# and am still
        learning the syntax.[color=blue]
        >-----Original Message-----
        > For starters, I see some "<>" that should be "!="
        >
        >"Phill" <anonymous@disc ussions.microso ft.com> wrote in[/color]
        message[color=blue]
        >news:00e101c3a c88$182b81a0$a5 01280a@phx.gbl. ..[color=green]
        >> I am getting a build error but it doesn't give me an
        >> error message. I know it has to do with the following
        >> line of code. What could be the problem and why don't[/color][/color]
        I[color=blue][color=green]
        >> get an error message? Thanks.
        >>
        >> for (int i = 0; i <= detailView1.Ite ms.Count - 1; i++)
        >> {
        >> if (detailView1.It ems[i].GetType().ToSt ring().EndsWith
        >> ("ItemDateTime" ))
        >> {
        >> if advancedList1.S electedRow[detailView1.Ite ms
        >> [i].Name].ToString() <> ""
        >>
        >> detailView1.Ite ms[i].Value =
        >> advancedList1.S electedRow[detailView1.Ite ms[i].Name]
        >> else
        >>
        >> detailView1.Ite ms[i].Value =
        >> advancedList1.S electedRow[detailView1.Ite ms[i].Name]
        >> }
        >> {
        >>
        >> detailView1.Ite ms[i].Value =
        >> advancedList1.S electedRow[detailView1.Ite ms[i].Name];
        >>
        >> }
        >> }[/color]
        >
        >
        >.
        >[/color]

        Comment

        • Phill

          #5
          Re: Build error, no message

          Thank you. All is good now that I know the rules.[color=blue]
          >-----Original Message-----
          >
          >"Phill" wrote...[color=green]
          >> I am getting a build error but it doesn't give me an
          >> error message. I know it has to do with the following
          >> line of code. What could be the problem ...[/color]
          >
          > - Every if-expression must have
          > parantheses around the condition.
          >
          > - All sentences must end with semicolon
          >
          > - In C# we use "!=" instead of "<>"
          >
          >// Bjorn A
          >
          >
          >.
          >[/color]

          Comment

          • Martin Stainsby

            #6
            Re: Build error, no message


            "Phill" <anonymous@disc ussions.microso ft.com> wrote in message
            news:00e101c3ac 88$182b81a0$a50 1280a@phx.gbl.. .[color=blue]
            > I am getting a build error but it doesn't give me an
            > error message. I know it has to do with the following
            > line of code. What could be the problem and why don't I
            > get an error message? Thanks.
            >
            > for (int i = 0; i <= detailView1.Ite ms.Count - 1; i++)
            > {[/color]

            Are you sure you need the -1.

            ussually see this when the = sign is not used.

            eg
            for (int i = 0; i < detailView1.Ite ms.Count - 1; i++) // no = sign.

            or
            for (int i = 0; i <= detailView1.Ite ms.Count ; i++) // no -1



            Comment

            • Martin Stainsby

              #7
              Re: Build error, no message


              "Martin Stainsby" <getenoughspam@ alreadythankyou > wrote in message
              news:ePf2hTKrDH A.2616@TK2MSFTN GP09.phx.gbl...[color=blue]
              >
              > "Phill" <anonymous@disc ussions.microso ft.com> wrote in message
              > news:00e101c3ac 88$182b81a0$a50 1280a@phx.gbl.. .[color=green]
              > > I am getting a build error but it doesn't give me an
              > > error message. I know it has to do with the following
              > > line of code. What could be the problem and why don't I
              > > get an error message? Thanks.
              > >
              > > for (int i = 0; i <= detailView1.Ite ms.Count - 1; i++)
              > > {[/color]
              >
              > Are you sure you need the -1.
              >
              > ussually see this when the = sign is not used.
              >
              > eg
              > for (int i = 0; i < detailView1.Ite ms.Count - 1; i++) // no = sign.
              >
              > or
              > for (int i = 0; i <= detailView1.Ite ms.Count ; i++) // no -1
              >[/color]

              Beers kicking in.......

              for (int i = 0; i = detailView1.Ite ms.Count - 1; i++) // no < sign.
              or
              for (int i = 0; i < detailView1.Ite ms.Count ; i++) // no -1





              Comment

              • Bjorn Abelli

                #8
                Re: Build error, no message

                "Martin Stainsby" wrote...[color=blue]
                > "Phill" wrote in message...
                >
                >[color=green]
                > > for (int i = 0; i <= detailView1.Ite ms.Count - 1; i++)[/color]
                >
                > Are you sure you need the -1.
                > ussually see this when the = sign is not used.[/color]

                You're correct that it usually isn't needed, but it is still syntactically
                and logically correct code. Your examples are misleading since you've got
                them the other way around.

                If he wants to iterate through the whole collection, his use of -1 is
                correct, but unneccessary, since the following does exactly the same thing,
                but with one operation less per iteration (no -1, hence no = sign):

                for (int i = 0; i < detailView1.Ite ms.Count; i++)

                In your first example he would miss the last item:
                [color=blue]
                > for (int i = 0; i < detailView1.Ite ms.Count - 1; i++) // no = sign.[/color]

                ....and in your secon example he would run past the last item...
                [color=blue]
                > for (int i = 0; i <= detailView1.Ite ms.Count ; i++) // no -1[/color]

                ....and an Exception would occur.

                // Bjorn A


                Comment

                • Martin Stainsby

                  #9
                  Re: Build error, no message


                  "Bjorn Abelli" <bjorn_abelli@D oNotSpam.hotmai l.com> wrote in message
                  news:%23YY%23yd KrDHA.392@TK2MS FTNGP11.phx.gbl ...[color=blue]
                  >
                  > In your first example he would miss the last item:
                  >[color=green]
                  > > for (int i = 0; i < detailView1.Ite ms.Count - 1; i++) // no = sign.[/color]
                  >
                  > ...and in your secon example he would run past the last item...
                  >[color=green]
                  > > for (int i = 0; i <= detailView1.Ite ms.Count ; i++) // no -1[/color]
                  >
                  > ...and an Exception would occur.
                  >
                  > // Bjorn A
                  >
                  >[/color]

                  Yes I realised this, hence the reply I sent. Although you explain it nicely.


                  Comment

                  • Grant Richins [MS]

                    #10
                    Re: Build error, no message

                    Can you please post the entire contents of the build output window and the
                    task window? It's possible the error message is just scrolling out of view?

                    --
                    --Grant
                    This posting is provided "AS IS" with no warranties, and confers no rights.


                    "Phill" <anonymous@disc ussions.microso ft.com> wrote in message
                    news:00e101c3ac 88$182b81a0$a50 1280a@phx.gbl.. .[color=blue]
                    > I am getting a build error but it doesn't give me an
                    > error message. I know it has to do with the following
                    > line of code. What could be the problem and why don't I
                    > get an error message? Thanks.
                    >
                    > for (int i = 0; i <= detailView1.Ite ms.Count - 1; i++)
                    > {
                    > if (detailView1.It ems[i].GetType().ToSt ring().EndsWith
                    > ("ItemDateTime" ))
                    > {
                    > if advancedList1.S electedRow[detailView1.Ite ms
                    > [i].Name].ToString() <> ""
                    >
                    > detailView1.Ite ms[i].Value =
                    > advancedList1.S electedRow[detailView1.Ite ms[i].Name]
                    > else
                    >
                    > detailView1.Ite ms[i].Value =
                    > advancedList1.S electedRow[detailView1.Ite ms[i].Name]
                    > }
                    > {
                    >
                    > detailView1.Ite ms[i].Value =
                    > advancedList1.S electedRow[detailView1.Ite ms[i].Name];
                    >
                    > }
                    > }[/color]


                    Comment

                    Working...