Quick Search for:  in language:    
IDE,TRUE,FALSE,EXE,Often,times,writing,applic
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,029,109. lines
 Jobs: 121. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Winsock with the boy
By Daniel Callander on 7/9


Click here to see a screenshot of this code!__AA Hack Keys
By JAKI on 7/9

(Screen Shot)

RSH from VBScript - execute command on UNIX or LINUX
By Roby Kott on 7/9


VBScript samples
By Roby Kott on 7/9


DBA tools
By Roby Kott on 7/9


Monitoring Tools
By Roby Kott on 7/9


Monitor Tools
By Roby Kott on 7/9


Make Path / Create Dir
By Dream on 7/9


Venus MUD Server
By Andrew Armstrong on 7/9


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

InDesignMode

Print
Email
 

Submitted on: 6/25/2003 4:38:46 PM
By: Jay Goldberg  
Level: Intermediate
User Rating: Unrated
Compatibility:VB 6.0

Users have accessed this article 391 times.
 
 
     Often times when writing an application, I want the user to be prompted when he quits the program (ie. "Are you sure you want to quit?"). The only thing about this is when I am debugging the program and using it myself in VB's IDE, I find this messagebox to be annoying. So I wrote this little function that will return TRUE if the app is running in the IDE, and FALSE if it running as a EXE.

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
Function InDesignMode() As Boolean

On Error GoTo Err Debug.Print 1 / 0 InDesignMode = False Exit Function Err: InDesignMode = True End Function

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
6/25/2003 4:40:15 PM:CrazyJew
I've previously posted this Function, but I saw someone somewhere asking for one of this nature so I will re-post. Enjoy.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/25/2003 8:48:05 PM:noroom
i guess this works only because debug.print lines are ignored when compiled as an exe, right?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/26/2003 4:02:20 AM:Andrew Murphy
No, it errors because of division by 0, mathmatically impossible
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/26/2003 7:53:23 AM:VB-ASP-Coder
USING CONDITIONAL COMPILATION You can use conditional compilation to selectively run blocks of code. The following sample macro uses conditional compilation: Sub Test() #Const Debugging = 1 Dim Name As String: Name = "Nancy" ' If you are debugging, change the Debugging constant to 0. #If Debugging = 0 Then ' This debug statement is not executed unless the Debugging ' constant is equal to zero. Debug.Print Name #End If Name = "Kerry" End Sub The behavior of the #If...Then...#Else conditional compilation directive is the same as the If...Then...Else statement. However, code that is excluded during conditional compilation is completely omitted from the final executable file; so, using conditional compilation has no size or performance disadvantages
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/26/2003 9:20:38 AM:Techni Rei Myoko
ever tried using the app.logmode? 0 = in vb 1 = not
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.