Question : How to identify at runtime if the sw is in debug or release mode (VB.NET)

I have a VB.NET application that needs to do some actions only in "Release mode" and not do them in "Debug" mode while I develop and test it in the visual studio environment.
How can identify in code at runtime in what mode Im operating?
And then I can have an IF statement for the operations required in each mode

Answer : How to identify at runtime if the sw is in debug or release mode (VB.NET)

You can use System.Diagnostics.Debugger.IsAttached():
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Public Class Form1
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If System.Diagnostics.Debugger.IsAttached Then
            MessageBox.Show("Hello from IDE")
        Else
            MessageBox.Show("Hello from EXE")
        End If
    End Sub
 
End Class
Random Solutions  
 
programming4us programming4us