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

Timing 2

Status
Not open for further replies.

LakotaMan

Instructor
Aug 21, 2001
240
0
0
US
This may be a newbie question, so I hope you'll forgive.
I need to display a form for a certain number of seconds. Do I use a timer control, and if so, how do I code it?

Any help will be greatly appreciated.

Thanks!
 

Give this a try... Start a new project and paste this code in Form1

[tt]
Option Explicit

Dim TimerCount As Integer

Private Sub Form_Load()

Timer1.Enabled = True
Timer1.Interval = 1000

End Sub

Private Sub Timer1_Timer()

If TimerCount > 5 Then
Unload Me
Else
TimerCount = TimerCount + 1
End If

End Sub

[/tt]

Good Luck
 
The easy way:
Add a Timer (Timer1) to your form

In form_load event:
Timer1.Interval = 5000 ' 5 secs
Timer1.Enabled = True

In the Timer1_Timer Event
Unload Me
Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
vb5prgrmr,

We appear to have posted together! Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Oops! I should have specified that I want to time a Splash form that is part of a start up procedure. I did your code, as suggested, in a new project --worked great! I just can't seem to adapt this for my start up procedure (main.bas), which looks something like this:


frmSplash.show
load frmInput
load frmAssesment
load Extra
unload frmSplash
frmInput.show

Once again, thanks in advance for any help!
 

Remove the "Unload frmSplash" and use either of our codes and give that a test.
 
Sounds like you want your splash screen to show instead of showing a retangle as my splash screen has in the past. I put a delay in.....

try this....

put in main.bas

frmSplash.Show
Delay (1)


Then call this function...

Public Function Delay(HowLong As Integer)
Dim PauseTime, Start

PauseTime = HowLong ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents
Loop
End Function



Hope this helps...

 
1SorryDog, that did the trick!

Thanks so much to everybody for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top