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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

timer problems

Status
Not open for further replies.

JayKay

Technical User
Jun 27, 2002
8
CA
I have a problem with my welcome screen, which has timer. It comes on for 5 seconds then, i set the .visible property to False and my menu then appears.

However if i close the program using the 'X' in the top right corner of the the form only disapears and doesn't close properly, i have to press the stop button on the VB taskbar.

Have i missed anything?
Thanx
 
I don't *know* the answer, but this might help...

Look at the form's unload event, and slap a messagebox in there. Is it being fired when you close the form?

If it is, replace the msgbox call with timer1.enabled = false. If not, put timer1.enabled = false in the terminate event.

It might work, you never know...


(I'm thinking that behind the scenes in the API there is a timer running, which might keep the session running)

 
How do i unload the form, or can i just change the .visible property?
 
Instead of using a timer, you might consider doing this:

Private Sub sleep()
Dim CurTime As Date
CurTime = Timer
Do Until Timer - CurTime > 5
Loop
End Sub
 
Try this in the timer event of your welcome screen

Private Sub timUnload_Timer()
Unload frmWelcome 'or Unload Me
Set frmWelcome = Nothing
End Sub

Hope this helps Anything is possible, the problem is I only have one lifetime.
[cheers]
 
Can't you just nick the template splash form in VB?
 
Private Sub tmrWelcome_Timer()
'Close welcome (splash) screen/ form
frmWelcome.Visible = False
'Display menu form
frmMenu.Visible = True
'disable timer
tmrWelcome.Enabled = False
End Sub


this is all i have (btw, i don't want to use a VB splash screen as i havn't been taught how too.)

and the problem, again, is...

the welcome form is made invisible, and the menu is shown. But, if i click on the 'X' in the top right of the window, the program, just becomes invisible rather than closing down.

Before, i didn't have the timer disabled after the new form is shown so when i pressed 'X' on the window again, it went invisible and then re-appeared after 5 seconds (the timer interval).

thanx
 
anyone got any more ideas, as i've tried your previous suggestions and none have worked.

thanx
 
Is there a reason you don't want to unload the welcome form? Anything is possible, the problem is I only have one lifetime.
[cheers]
 
Try this...

Set the timer's enabled property to true at design time, and it's interval to 5000.


Private Sub tmrWelcome_Timer()
'Close welcome (splash) screen/ form
frmWelcome.Visible = False
'Display menu form
frmMenu.Visible = True
'disable timer
tmrWelcome.Enabled = False
'Unload the current form
unload Me

End Sub
 
no, but when i did that, like you suggested, it still happened.
 
That worked, cheers mmilan

thanks for all your help guys!

cheers
 
When My exe is running in visual basic .. the form becomes static and nuthing appears on it .. can i do something so that muh form is visible , or mebbe i could pop another form into it ...
okay ... thats muh problem ... hope i can get an answer
thanks
shanks_who ?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top