|
|
#1 |
|
Hyperactive Member
Join Date: May 09
Posts: 324
![]() |
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, |
|
|
|
|
|
#2 |
|
VBaholic & Loving It
Join Date: Oct 07
Location: GetWindowRect()
Posts: 7,895
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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.
__________________
Insomnia is just a byproduct of, "It can't be done" Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum. Read the HitchHiker's Guide to Getting Help on the Forums. {Memory Leak FAQ} {GDI+ Classes/Samples} {Unicode Open/Save Dialog} {Icon Organizer/Extractor} {VBA Control Arrays} {XP/Vista Manifest Creator} {UserControl Button Template} {stdPicture Render Usage} Last edited by LaVolpe; Nov 28th, 2009 at 11:11 AM. |
|
|
|
|
|
#3 |
|
Lively Member
Join Date: Nov 09
Location: Virginia
Posts: 105
![]() |
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 |
|
|
|
|
|
#4 |
|
Hyperactive Member
Join Date: May 09
Posts: 324
![]() |
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 |
|
|
|
|
|
#5 |
|
PowerPoster
Join Date: Dec 04
Posts: 13,424
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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 |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|