How to highlight a block that is excluded by #if #endif in Visual Basic 2008 SP1 as it is in C# and C++

Bloqueada How to highlight a block that is excluded by #if #endif in Visual Basic 2008 SP1 as it is in C# and C++

  • lunes, 29 de junio de 2009 20:53
     
     
    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.

Todas las respuestas

  • martes, 30 de junio de 2009 17:10
     
     
    i think the block is not support in vb. I may be wrong

    kaymaf
    I hope this helps, if that is what you want, just mark it as answer so that we can move on
  • martes, 30 de junio de 2009 17:21
     
     
    Conditional 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.
  • viernes, 20 de enero de 2012 17:05
     
     

    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.