How to highlight a block that is excluded by #if #endif in Visual Basic 2008 SP1 as it is in C# and C++
Monday, June 29, 2009 8:53 PMWhen 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.
Tuesday, June 30, 2009 5:10 PMi think the block is not support in vb. I may be wrong
I hope this helps, if that is what you want, just mark it as answer so that we can move on
Tuesday, June 30, 2009 5:21 PMConditional compilation is most certainly supported in VB. If VB denotes an excluded block in some other fashion, I would like to know so I can change that text-type's formatting to be make the inactive block more visible.
Friday, January 20, 2012 5:05 PM
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.