In conditional compilation, particular blocks of code in a program are compiled selectively while others are ignored.
Reference: Conditional Compilation in Visual Basic
For example if I Write this code in the form Load event:
When I build in DEBUG mode, the "MsgBox("This is DEBUG build")" and when I build in RELEASE mode or any other custom mode, the "MsgBox("This is not a DEBUG build")" will be triggered.Private Sub frmStarter_Load(sender As Object, e As EventArgs) Handles Me.Load #If DEBUG Then MsgBox("This is DEBUG build") #Else MsgBox("This is not a DEBUG build") #End IfEnd Sub
This is really handy.
No comments:
Post a Comment