You are here: DEVPPL Forum Programming Visual Basic Forum
NOTIFICATIONS
54.087
MEMBERS
15.684
TOPICS
62.255
POSTS
  562
FLASH GAMES
7.740
TUTORIALS
 

Login

E-mail:
Password:

Pop Up At A Certain Time?

0

Loading

Re: Pop Up At A Certain Time?

Postby CoderKid » Tue Nov 01, 2011 1: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
 
Reputation: 0
Posts: 1
Joined: Tue Nov 01, 2011 12:35 am
Highscores: 0
Arcade winning challenges: 0

Re: Pop Up At A Certain Time? - Sponsored results

Sponsored results

Login to get rid of ads

 

^ Back to Top