Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Sep 8, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Determine if Your Program is Running Within VB's IDE

Sometimes it is useful to know if your program is running within Visual Basic's Integrated Development Environment (IDE) or as a standalone EXE. This routine returns True if the program is running within VB's IDE:
 Public Function RunningInIDE() As Boolean
	'Assume running as EXE for now
	RunningInIDE = False
	'Trap errors
	On Error GoTo RunningInIDEErr
	'Divide by zero (fails within IDE)
	Debug.Print 1 / 0
	'Exit if no error
	Exit Function
	'We get error if Debug.Print was
	'evaluated (i.e. running in the VB IDE)
	RunningInIDE = True
End Function

RunningInIDE performs a division by zero in a Debug.Print statement. Within the IDE, this causes a divide overflow, which the function traps in an error handler. When the program is run as a standalone EXE, Debug.Print statements are not evaluated and no error occurs.

Jeffrey Sahol
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date