Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

exit sub ... end sub ..??!?

Posted on 1999-01-25
4
Medium Priority
?
544 Views
Last Modified: 2010-05-03
what's the different between exit sub and end sub ?

will exit sub make a form stay active (hide but not shown) even when you terminate the application ?

thanks
0
Comment
Question by:tsung
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
CraigLazar earned 100 total points
ID: 1470714
Hi
Exit sub - means thath if say you have a procedure or a value thath is reached and you want the execution of your sub routine to stop and not carry on . form still stays open

end sub - means thath the code in a sub routine has all been executed and that object is now finnished

Example - Exit sub
say u put in a validatioon on a field like this
Private sub Field1_lostfocus()
   the value in field1 is either null or a value u are not happy with
i use exit sub like this
if field1 = "" then
   field1.setfocus
   exit sub
end if

or in an error handler you will use exit sub often cause say the user has not filled in correct info so you do not want your app to bom so place an exit sub to prevent it and force the user back to were he should go or give them an message box or something

hope it helps

Craig
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1470715
what is the sub you are using those two on?

0
 

Author Comment

by:tsung
ID: 1470716
like you said Craig, if i use exit sub, this mean the form will not get closed ? then will it be danger if i replace the exit sub with "unload me" ? coz i just have an exprience yesterday that the program didn't get terminate althought the last form got unloaded. and that was happended during the development.
0
 
LVL 4

Expert Comment

by:CraigLazar
ID: 1470717
Well friend u can try that, so so u want to close that form automatically ?
if so i would make a safer rout in thath not firectly replace exit sub with unload me . What i would do is create an small sub routine say called exitform. I would replace your exit sub with
call exitform
in exit form i would then call unload me

try that
ps.if u still have problems or unsure mail me the piece of code and i will look at it for you clazar@softnet.co.za
good luck
Craig

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question