In VB.NET, there is no real difference between running within the ide and not within the ide. I think what you're looking for is a way of determining whether the app was compiled for Debug or Release. Here is a way of doing that:
Code:
#If Debug Then
    'Compiled for Debug
    'Put code here
#Else
    'Compiled for Release
    'Put code here
#End If