comment out a large portion of codes

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

    #1

    comment out a large portion of codes

    Does anyone know if there is a way to get VB.net to let me comment out a
    large portion of codes? Like in C/C++, I was able to comment out using /*
    ...... */ I think there is something to do with "Define Debug Constant = 1"
    but I am not sure how it works. thanks.
  • Marina

    #2
    Re: comment out a large portion of codes

    It doesn't have anyline like that. However, the IDE has a 'Comment
    Selection' and 'Uncomment Selection' functionality. You can select a block
    of code, and perform the action. It's not as good, but it is better then
    nothing.

    "Ben" <Ben@discussion s.microsoft.com > wrote in message
    news:B94ACDB1-D9DF-434F-969C-69760475CE2E@mi crosoft.com...[color=blue]
    > Does anyone know if there is a way to get VB.net to let me comment out a
    > large portion of codes? Like in C/C++, I was able to comment out using /*
    > ..... */ I think there is something to do with "Define Debug Constant =
    > 1"
    > but I am not sure how it works. thanks.[/color]


    Comment

    • Kerry Moorman

      #3
      RE: comment out a large portion of codes

      Ben,

      Highlight the block of code and click the Comment or Uncomment buttons on
      the Edit toolbar.

      Kerry Moorman


      "Ben" wrote:
      [color=blue]
      > Does anyone know if there is a way to get VB.net to let me comment out a
      > large portion of codes? Like in C/C++, I was able to comment out using /*
      > ..... */ I think there is something to do with "Define Debug Constant = 1"
      > but I am not sure how it works. thanks.[/color]

      Comment

      • AMercer

        #4
        RE: comment out a large portion of codes

        #If False Then
        < the code you want to comment out goes here>
        #End If
        [color=blue]
        > Does anyone know if there is a way to get VB.net to let me comment out a
        > large portion of codes? Like in C/C++, I was able to comment out using /*
        > ..... */ I think there is something to do with "Define Debug Constant = 1"
        > but I am not sure how it works. thanks.[/color]

        Comment

        • Mythran

          #5
          Re: comment out a large portion of codes


          "AMercer" <AMercer@discus sions.microsoft .com> wrote in message
          news:AC3F9263-7FA8-4B6B-8CC9-CA342617BEF1@mi crosoft.com...[color=blue]
          > #If False Then
          > < the code you want to comment out goes here>
          > #End If
          >[color=green]
          >> Does anyone know if there is a way to get VB.net to let me comment out a
          >> large portion of codes? Like in C/C++, I was able to comment out using
          >> /*
          >> ..... */ I think there is something to do with "Define Debug Constant =
          >> 1"
          >> but I am not sure how it works. thanks.[/color][/color]

          That won't work exactly how comments work. For example, anything in the #IF
          .... #END IF directives must be compilable code. You can't have any syntax
          errors in the code.

          HTH,
          Mythran

          Comment

          • Jay B. Harlow [MVP - Outlook]

            #6
            Re: comment out a large portion of codes

            Mythran,
            | That won't work exactly how comments work. For example, anything in the
            #IF
            | ... #END IF directives must be compilable code. You can't have any syntax
            | errors in the code.

            Odd! ;-) I've used #IF False on blocks of code that have syntax errors.

            For example the following block contains a syntax error (3.7x is not a valid
            literal). It compiles under VB.NET 2003.

            Public Sub Main()
            Dim s As Single
            #If False Then
            s = 3.7x
            #End If

            End Sub

            I would expect it to compile as #if is one of the Conditional Compilation
            statements.

            Are there specific syntax errors that you have used that cause the above not
            to work?

            Hope this helps
            Jay

            "Mythran" <kip_potter@hot mail.comREMOVET RAIL> wrote in message
            news:eQOaZxskFH A.1464@TK2MSFTN GP14.phx.gbl...
            |
            | "AMercer" <AMercer@discus sions.microsoft .com> wrote in message
            | news:AC3F9263-7FA8-4B6B-8CC9-CA342617BEF1@mi crosoft.com...
            | > #If False Then
            | > < the code you want to comment out goes here>
            | > #End If
            | >
            | >> Does anyone know if there is a way to get VB.net to let me comment out
            a
            | >> large portion of codes? Like in C/C++, I was able to comment out using
            | >> /*
            | >> ..... */ I think there is something to do with "Define Debug Constant
            =
            | >> 1"
            | >> but I am not sure how it works. thanks.
            |
            | That won't work exactly how comments work. For example, anything in the
            #IF
            | ... #END IF directives must be compilable code. You can't have any syntax
            | errors in the code.
            |
            | HTH,
            | Mythran
            |


            Comment

            • Herfried K. Wagner [MVP]

              #7
              Re: comment out a large portion of codes

              "Ben" <Ben@discussion s.microsoft.com > schrieb:[color=blue]
              > Does anyone know if there is a way to get VB.net to let me comment out a
              > large portion of codes? Like in C/C++, I was able to comment out using /*
              > ..... */[/color]

              The "Edit Text" toolbar and the "Edit" menu of VS.NET contains commands for
              commenting out blocks of code.

              --
              M S Herfried K. Wagner
              M V P <URL:http://dotnet.mvps.org/>
              V B <URL:http://classicvb.org/petition/>

              Comment

              • Tom Shelton

                #8
                Re: comment out a large portion of codes

                In article <AC3F9263-7FA8-4B6B-8CC9-CA342617BEF1@mi crosoft.com>, AMercer wrote:[color=blue]
                > #If False Then
                > < the code you want to comment out goes here>
                > #End If
                >[color=green]
                >> Does anyone know if there is a way to get VB.net to let me comment out a
                >> large portion of codes? Like in C/C++, I was able to comment out using /*
                >> ..... */ I think there is something to do with "Define Debug Constant = 1"
                >> but I am not sure how it works. thanks.[/color][/color]

                Highlight the code, hit Ctrl-K, Ctrl-C. To uncomment, highlight code,
                hit Ctrl-K, Ctrl-U

                HTH
                --
                Tom Shelton [MVP]

                Comment

                • Mythran

                  #9
                  Re: comment out a large portion of codes


                  "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP @msn.com> wrote in message
                  news:uXq9d3skFH A.3148@TK2MSFTN GP09.phx.gbl...[color=blue]
                  > Mythran,
                  > | That won't work exactly how comments work. For example, anything in the
                  > #IF
                  > | ... #END IF directives must be compilable code. You can't have any
                  > syntax
                  > | errors in the code.
                  >
                  > Odd! ;-) I've used #IF False on blocks of code that have syntax errors.
                  >
                  > For example the following block contains a syntax error (3.7x is not a
                  > valid
                  > literal). It compiles under VB.NET 2003.
                  >
                  > Public Sub Main()
                  > Dim s As Single
                  > #If False Then
                  > s = 3.7x
                  > #End If
                  >
                  > End Sub
                  >
                  > I would expect it to compile as #if is one of the Conditional Compilation
                  > statements.
                  >
                  > Are there specific syntax errors that you have used that cause the above
                  > not
                  > to work?
                  >
                  > Hope this helps
                  > Jay
                  >
                  > "Mythran" <kip_potter@hot mail.comREMOVET RAIL> wrote in message
                  > news:eQOaZxskFH A.1464@TK2MSFTN GP14.phx.gbl...
                  > |
                  > | "AMercer" <AMercer@discus sions.microsoft .com> wrote in message
                  > | news:AC3F9263-7FA8-4B6B-8CC9-CA342617BEF1@mi crosoft.com...
                  > | > #If False Then
                  > | > < the code you want to comment out goes here>
                  > | > #End If
                  > | >
                  > | >> Does anyone know if there is a way to get VB.net to let me comment
                  > out
                  > a
                  > | >> large portion of codes? Like in C/C++, I was able to comment out
                  > using
                  > | >> /*
                  > | >> ..... */ I think there is something to do with "Define Debug
                  > Constant
                  > =
                  > | >> 1"
                  > | >> but I am not sure how it works. thanks.
                  > |
                  > | That won't work exactly how comments work. For example, anything in the
                  > #IF
                  > | ... #END IF directives must be compilable code. You can't have any
                  > syntax
                  > | errors in the code.
                  > |
                  > | HTH,
                  > | Mythran
                  > |
                  >
                  >[/color]

                  LOL I knew I should have double-checked before I posted the reply :( Sorry,
                  I was wrong. I could have sworn...but I was wrong :)

                  Thanks for the correction, hope they caught it :)

                  Mythran

                  Comment

                  Working...