Results 1 to 5 of 5

Thread: Make form show at certain time?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    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. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    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.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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. #4

    Thread Starter
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    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. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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
  •  



Click Here to Expand Forum to Full Width