comment out a large portion of codes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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,

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

Kerry Moorman
 
AMercer said:
#If False Then

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
 
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

|
| | > #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
|
 
Ben said:
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 /*
..... */

The "Edit Text" toolbar and the "Edit" menu of VS.NET contains commands for
commenting out blocks of code.
 
Jay B. Harlow said:
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

|
| | > #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
|

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top