Home Articles VB.Net Articles Check whether the application is currently being debugged

Check whether the application is currently being debugged

If you want to know whether the application is currently being debugged you can use the following code;

Public Shared ReadOnly Property DebugMode() As Boolean
    Get
        Dim rtn As Boolean = False

#If DEBUG Then
         rtn = True
#End If
        Return rtn
    End Get
 End Property

The part of code in the if statement will only be executed if the application is currently being debugged, therefore the return value will be left as false.

Last Updated (Tuesday, 17 August 2010 10:50)