Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to VB! Can't suss timer out! 1

Status
Not open for further replies.

iMacDan

IS-IT--Management
May 16, 2002
13
0
0
GB
I want to exit my program by leaving a message on screen first.

So click exit it clears all info then prints a goodbye message. No Problem. But I need to make the end function wait a few secs while you see the message?

Otherwise you don't see it becasue the program closes too quickly!

Any Ideas?
 
One simple way would be to use the Sleep API Call. At the top of your form, declare the function.

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Then in form_unload event show your message, go to sleep, then shutdown

Private Sub Form_Unload(rInt_Cancel As Integer)

<show you goodbye message>
DoEvents
Sleep 5000 ' 5 seconds

End Sub
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
I'm sorry! That helps but I am really new to this programming bit!!!!!!

I have done what you said, know how do I get my cmdexit button to link to it and do it?

Thanks again in advance of help
 
Give this a shot

Assuming that your exit button is named cmdExit
then

Private Sub cmdExit_Click ()
Unload Me
End Sub

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
FANTASTIC

Thanks a lot that really helps.

Spot on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top