Library code snippets
Are You Running in the IDE?
Previous versions of Visual Basic made it easy to figure out whether you were running your application through the IDE (Integrated Development Environment). It simply allowed you to check which “mode” your application was in. VB.NET, however, isn’t quite as easy-going.
The most common method of figuring out whether the application is running in
the .NET IDE is to check the System.Diagnostics.Debugger.IsAttached property
to determine whether if a debugger is attached to the currently executing code.
If so, you can safely assume your code is running from within the IDE.
If you’re designing your own controls, you might also run into the situation
where your code is running in design mode—while you only want it to execute
during ‘full’ runtime. In this situation, simply check the DesignMode property of your component (that is, from inside your control: Me.DesignMode).
If it returns True, you’re running in the IDE—so cut your code
short.
Simple solutions to common questions, and definitely worth remembering.
Related articles
Related discussion
-
Why choose c# when there is Java
by Thaj06 (0 replies)
-
Change color while typing in rich text box
by Akhtar Hussain (0 replies)
-
Third party components to enhance User Interface of Windows based application
by Shaila14041981 (0 replies)
-
VB.NET DataGridView Sort
by bradhen (0 replies)
-
About Comparison in Asp.Net
by S_Rahul (0 replies)
Related podcasts
-
xpert to Expert: Inside Concurrent Basic (CB)
"Concurrent Basic extends Visual Basic with stylish asynchronous concurrency constructs derived from the join calculus. Our design advances earlier MSRC work on Polyphonic C#, Comega and the Joins Library. Unlike its C# based predecessors, CB adopts a simple event-like syntax familiar to VB progr...
#If Debug = True Then
'Code for debuging
#Else[/courier new]
'Code for the real thing
#End If
This thread is for discussions of Are You Running in the IDE?.