It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Pop Up At A Certain Time?

Moderator: dafunkymunky

Pop Up At A Certain Time?

Postby purplemonster on Fri May 15, 2009 12:23 am

I want to make a program so that when its a certain time like 1:53pm a msgbox box opens up to remind you to not forget anything.
purplemonster
 
Posts: 24
Joined: Fri Jul 04, 2008 9:01 pm

Re: Pop Up At A Certain Time?

Postby CoderKid on Tue Nov 01, 2011 12:57 am

purplemonster wrote:I want to make a program so that when its a certain time like 1:53pm a msgbox box opens up to remind you to not forget anything.

Do you mean like an alarm?

It's pretty easy...here's a simple alarm:
What you need:
2 Timers (Timer 1 needs to have a 1000 interval, and it needs to be enabled)
2 Labels
1 TextBox
1 Button
Code: Select all
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label2.Text = TextBox1.Text
        Timer2.Start()
        MsgBox("Your alarm has started")
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        If Label2.Text = TimeOfDay Then
            MessageBox.Show("YOUR ALARM MESSAGE HERE!")
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label1.Text = TimeOfDay
    End Sub

Now, lets test the program. Label 1 should now show the current date. Label 2 should say Label 2. Then, in TextBox1, type a time that is near to the current date. Click Button 1. A message Box should pop up saying: 'Your alarm has started'. Then, Label 2's text should now show the time that you typed in textBox1. Now, wait for the time you typed in textbox1. When that time comes, a message box should popup saying whatever your message is.
Note: you could also, instead of the message box, play music when the time comes. Replace that
Code: Select all
If Label2.Text = TimeOfDay Then
MessageBox.Show("YOUR MESSAGE HERE")

with:
Code: Select all
If Label2.Text = TimeOfDay Then
My.Computer.Audio.Play("DIRECTORY OF .WAV FILE HERE")

To stop the music, do:
Code: Select all
My.Computer.Audio.Stop()

Good Luck.
CoderKid
 
Posts: 1
Joined: Mon Oct 31, 2011 11:35 pm


Who is online

Users browsing this forum: No registered users and 9 guests