|
-
Nov 28th, 2009, 11:33 AM
#1
Thread Starter
Fanatic Member
Make form show at certain time?
Hi there, Does anybody know of a way to make a form show if it is a certain time ?
For example if my computers clock his 17:30 then form2.show?
I basically want it so that a user puts the time they want in text1.text and then when they press the command button then it will wait for the time they enterd and then form 2 will show!
Thanks,
-
Nov 28th, 2009, 12:00 PM
#2
Re: Make form show at certain time?
Add a timer to your form and set its interval for something like 10-20 secs.
In the timer's event, check the system time to see if: Time => TimeSerial(17,30,0).
If so, disable the timer and show the form.
Edited: You'd probably keep the timer disabled by default. When the button is clicked and you validated the user input is a valid time, then you'd enable the timer.
Last edited by LaVolpe; Nov 28th, 2009 at 12:11 PM.
-
Nov 28th, 2009, 12:36 PM
#3
Lively Member
Re: Make form show at certain time?
put this in the timer and just set it to the time you want the second form to show up
Code:
Private Sub Timer1_Timer()
Label1.Caption = Time
If Label1.Caption = "12:35:00 PM" Then
Form2.Show
Timer1.Enabled = False
End If
End Sub
-
Nov 29th, 2009, 02:08 AM
#4
Thread Starter
Fanatic Member
Re: Make form show at certain time?
Thankyou!
I have gone with
Code:
Label3.Caption = Time
If Label3.Caption = "07:06:01" Then
Form2.Show
Timer1.Enabled = False
End If
But how can i make it so the time the form pops up will be what the user puts in.
I Have 3 comboBox and one called hour (which has 1 - 24) Minutes (0 - 59) and seconds.
How can i make it like
if label3.caption ="" the hour a user selects , the seconds the user selects and the minutes?
Thanks
-
Nov 29th, 2009, 03:16 AM
#5
Re: Make form show at certain time?
If time = timeserial(combohour.text, combomin.text, combosec.text) Then
but if the timer misses the exact second in the seconds combo the event won't fire, you would need your timer interval to be under ½ second if you want to be that accurate, or use if time >
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|