How to highlight a block that is excluded by #if #endif in Visual Basic 2008 SP1 as it is in C# and C++
When I exclude a block using #if #endif in VB.Net there is no visual evidence that the block has actually been excluded unless I indent the block and it does not return to the left margin. I checked the active settings for Fonts and the Excluded Code colorization is identical to that of C# and C++. However, the block is not colorized at all. VB clearly knows the block has been excluded, but I cannot figure out how to get the block highlighted as it is in C# and C++. I would appreciate any advice on how to get excluded VB blocks to be color coded.29 Haziran 2009 Pazartesi 20:53
I too would like to know how to do this. Rather than start a new thread, I decided to reply here.
I am using Visual Basic 2008 express.
I have a sample bit of code that uses conditional compilation (for a data acquisition system). In this sample, the constants are defined in the project properties->compile->advanced compiler settings, custom constants text box. My understanding of doing it this way is that these constants then apply to the entire project.
I tried doing three things: (1) removing one of these constants (there are two) from the custom constants text box, but the corresponding code did not dim, and (2) make two separate projects (I think) with the build configuration manager, and in each, I defined only the proper custom constant for that build. Then I toggled between these with the build Solutions Configuration dropdown menu. This did not dim the code either (3) I used #Const in the code (below the Imports statement at the top of the Form class) to define the custom constant. This also failed to dim the conditional code block.
I therefore wonder if there is a setting in my IDE that is incorrect, causing the conditional code to not dim when I change the constants. If that is possible, where do I look to change the the settings to dim the conditional code when the constant "de-selects" the conditional code? Or, maybe I made a mistake in my three approaches above?
Thanks for any help.20 Ocak 2012 Cuma 17:05