Results 1 to 6 of 6

Thread: MSGBOX at Time?

  1. #1

    Thread Starter
    Banned
    Join Date
    Jan 2008
    Posts
    68

    Exclamation MSGBOX at Time?

    Hello!
    I've wonder about a program i should need, and should be fun to creat!

    I make a program, there i write in a textbox, for example i write "Prision break start now!"

    then i type a time, example "22:00"

    Then i press a button i'll call start

    Then when the computer time is 22:00 , then a MSGBOX will popup with that text "Prision break start now!"

    Can someone help me!?


    I really dont know how to write that with the times on the computer

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: MSGBOX at Time?

    Are you familiar with using the Timer control?

    What happens after the messagebox is clicked on?

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: MSGBOX at Time?

    As said you will a Timer control on your form and perhaps DateTimePicker (can be found in MS Windows Common Controls 2 6.0).
    So, add those to your form as well as textbox and copy/paste/run this sample code:
    Code:
    Option Explicit
    
    Dim myTime As String
    
    Private Sub Form_Load()
        Timer1.Enabled = False
        Timer1.Interval = 1000 '1 second <<< 60000 = 1 minute
        DTPicker1.Format = dtpTime
        DTPicker1.Value = Now
    End Sub
    
    Private Sub Command1_Click()
    
        myTime = DTPicker1.Value
        Timer1.Enabled = True
    
    End Sub
    
    Private Sub DTPicker1_Change()
        If DTPicker1.Value < Now Then DTPicker1.Value = Now
    End Sub
    
    Private Sub Timer1_Timer()
    
        If CDate(myTime) = Now Then
            MsgBox Text1.Text
            
            'you may need to call some function here
            
            Timer1.Enabled = False
        End If
    
    End Sub

  4. #4

    Thread Starter
    Banned
    Join Date
    Jan 2008
    Posts
    68

    Question Re: MSGBOX at Time?

    Quote Originally Posted by RhinoBull
    As said you will a Timer control on your form and perhaps DateTimePicker (can be found in MS Windows Common Controls 2 6.0).
    So, add those to your form as well as textbox and copy/paste/run this sample code:
    Code:
    Option Explicit
    
    Dim myTime As String
    
    Private Sub Form_Load()
        Timer1.Enabled = False
        Timer1.Interval = 1000 '1 second <<< 60000 = 1 minute
        DTPicker1.Format = dtpTime
        DTPicker1.Value = Now
    End Sub
    
    Private Sub Command1_Click()
    
        myTime = DTPicker1.Value
        Timer1.Enabled = True
    
    End Sub
    
    Private Sub DTPicker1_Change()
        If DTPicker1.Value < Now Then DTPicker1.Value = Now
    End Sub
    
    Private Sub Timer1_Timer()
    
        If CDate(myTime) = Now Then
            MsgBox Text1.Text
            
            'you may need to call some function here
            
            Timer1.Enabled = False
        End If
    
    End Sub

    Thanx alot! but 1 problem! i press CTRL + T and i dont find

    MS Windows Common Controls 2 6.0
    or
    Microsoft Windows Common Controls 2 6.0

    Do i need to download it somewere!? :S i only find other versions,


    [EDIT]]]

    Oh i found now! but cannot i take another thing then that Date picker!? also, its hard to change it, when i change it, also click on it, then 2 numbers going too be marked blue you know,

    then when i press like 40 its going crazy :S also test yourselves to change times sometimes and you will see whats happends :S



    [EDIT #2]]]

    Ehm, whatever , it wrks if i press them so they get marked, then press arrow up or down,,,


    But the biggest problem i got now, is when the time is over and the popup will become up, then i only hear sound, and nothing come, but when i open the program, also click on it there down, then i see the MSGBOx!

    I must fix it, but how? ;S
    Last edited by SwedeNpro; Jan 30th, 2008 at 11:02 AM.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: MSGBOX at Time?

    You have to have the form displayed on the screen, not minimized.

  6. #6

    Thread Starter
    Banned
    Join Date
    Jan 2008
    Posts
    68

    Re: MSGBOX at Time?

    Quote Originally Posted by Hack
    You have to have the form displayed on the screen, not minimized.

    I know!!!

    But does it not work to do something? also when the time is over, then my program can maximaze or something and then the popup will show? ;S

    Or just a program with "TopOnly" will bee showing?

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