Hey there i am just starting programming in vb and what i need is

1. to be able to print what day it is monday, tuesday, wed.. etc in a text box just the code for this is what i need.
2. want to have the time in another box
3. want to be able to be able to play a file when ever its hits a certain time of the day each day. The file does not varry just need to format for the shell command in vb so if i want to fun "c:\windows\welcome.wav" do not mind if it opens winamp to play the file.
4. how to i get the form to cheack a list of if statments every hour without having someone click on the button called test time? can i edit this maby: Private Sub Command1_Click()?

It only has to run 5 days a week

So i guess 5 different arrays that check the text boxes depending on what day it is. if you help me with hte top 4 things i can probable do the rest.

Thanks

Attachments bell.JPG 96.89 KB

Put two textboxes, one label and one timer on a form . Copy and paste

Dim i As Integer
Dim starttime As Date


Private Sub Form_Load()

Text2.Text = InputBox("Enter Time", "Set Time", "3:40:00 PM")
Timer1.Interval = 1000  'set to one second
Label1.Caption = Time
End Sub
Private Sub Timer1_Timer()
Text1.Text = WeekdayName(Weekday(Date))
Label1.Caption = Time
    If Time = Text2.Text Then
        Shell "cmd.exe /c start x:\PinkFloyd-Wall.wma"
        DoEvents
        
        End If
End Sub

Private Sub Form_Load()

Timer1.Interval = 1
lbMessage.Caption = ""
Text1.Text = ""

montext(0) = "07:30:00"
montext(1) = "07:40:00"
montext(2) = "07:55:00"
montext(3) = "08:00:00"
montext(4) = "08:15:00"
montext(5) = "08:30:00"
montext(6) = "08:35:00"
montext(7) = "09:10:00"
montext(8) = "09:50:00"
montext(9) = "10:30:00"
montext(10) = "10:45:00"
montext(11) = "11:25:00"
montext(12) = "12:05:00"
montext(13) = "12:10:00"
montext(14) = "12:45:00"
montext(15) = "12:50:00"
montext(16) = "13:25:00"
montext(17) = "13:35:00"
montext(18) = "14:15:00"
montext(19) = "14:55:00"
montext(20) = "15:30:00"
montext(21) = "16:00:00"
montext(22) = "16:10:00"
montext(23) = "18:00:00"
montext(24) = ""
montext(25) = ""

tuetext(0) = "07:30:00"
tuetext(1) = "07:40:00"
tuetext(2) = "07:55:00"
tuetext(3) = "08:00:00"
tuetext(4) = "08:15:00"
tuetext(5) = "08:30:00"
tuetext(6) = "08:35:00"
tuetext(7) = "09:10:00"
tuetext(8) = "09:50:00"
tuetext(9) = "10:30:00"
tuetext(10) = "10:45:00"
tuetext(11) = "11:25:00"
tuetext(12) = "12:05:00"
tuetext(13) = "12:10:00"
tuetext(14) = "12:45:00"
tuetext(15) = "12:50:00"
tuetext(16) = "13:25:00"
tuetext(17) = "13:35:00"
tuetext(18) = "14:15:00"
tuetext(19) = "14:55:00"
tuetext(20) = "15:30:00"
tuetext(21) = "16:00:00"
tuetext(22) = "16:10:00"
tuetext(23) = "18:00:00"
tuetext(24) = ""
tuetext(25) = ""

thutext(0) = "07:30:00"
thutext(1) = "07:40:00"
thutext(2) = "07:55:00"
thutext(3) = "08:00:00"
thutext(4) = "08:15:00"
thutext(5) = "08:30:00"
thutext(6) = "08:35:00"
thutext(7) = "09:10:00"
thutext(8) = "09:50:00"
thutext(9) = "10:30:00"
thutext(10) = "10:45:00"
thutext(11) = "11:25:00"
thutext(12) = "12:05:00"
thutext(13) = "12:10:00"
thutext(14) = "12:45:00"
thutext(15) = "12:50:00"
thutext(16) = "13:25:00"
thutext(17) = "13:35:00"
thutext(18) = "14:15:00"
thutext(19) = "14:55:00"
thutext(20) = "15:30:00"
thutext(21) = "16:00:00"
thutext(22) = "16:10:00"
thutext(23) = "18:00:00"
thutext(24) = ""
thutext(25) = ""

fritext(0) = "07:30:00"
fritext(1) = "07:40:00"
fritext(2) = "07:55:00"
fritext(3) = "08:00:00"
fritext(4) = "08:15:00"
fritext(5) = "08:30:00"
fritext(6) = "08:35:00"
fritext(7) = "09:10:00"
fritext(8) = "09:50:00"
fritext(9) = "10:30:00"
fritext(10) = "10:45:00"
fritext(11) = "11:25:00"
fritext(12) = "12:05:00"
fritext(13) = "12:10:00"
fritext(14) = "12:45:00"
fritext(15) = "12:50:00"
fritext(16) = "13:25:00"
fritext(17) = "13:35:00"
fritext(18) = "14:15:00"
fritext(19) = "14:55:00"
fritext(20) = "15:30:00"
fritext(21) = "16:00:00"
fritext(22) = "16:10:00"
fritext(23) = "18:00:00"
fritext(24) = ""
fritext(25) = ""

wedtext(0) = "07:30:00"
wedtext(1) = "07:40:00"
wedtext(2) = "07:55:00"
wedtext(3) = "08:00:00"
wedtext(4) = "08:15:00"
wedtext(5) = "08:50:00"
wedtext(6) = "09:25:00"
wedtext(7) = "10:00:00"
wedtext(8) = "10:15:00"
wedtext(9) = "10:50:00"
wedtext(10) = "11:25:00"
wedtext(11) = "12:00:00"
wedtext(12) = "12:05:00"
wedtext(13) = "12:35:00"
wedtext(14) = "13:20:00"
wedtext(15) = "13:55:00"
wedtext(16) = "14:15:00"
wedtext(17) = "14:30:00"
wedtext(18) = "14:55:00"
wedtext(19) = "15:00:00"
wedtext(20) = "17:00:00"
wedtext(21) = ""
wedtext(22) = ""
wedtext(23) = ""
wedtext(24) = ""
wedtext(25) = ""

End Sub

Private Sub Label4_Change()

If Text1.Text = "Mon" Then
For i = 0 To 25
If montext(i).Text = Label4.Caption Then
lbMessage.Caption = "TIME"
Shell ("c:\Program Files\Winamp\winamp.exe E:\Musci\Door_bell.mid")
Else
lbMessage.Caption = "Monday"
End If
Next i
End If

If Text1.Text = "Tue" Then
For i = 0 To 25
If tuetext(i).Text = Label4.Caption Then
lbMessage.Caption = "TIME"
Shell ("c:\Program Files\Winamp\winamp.exe E:\Musci\Door_bell.mid")
Else
lbMessage.Caption = "Tuesday"
End If
Next i
End If

If Text1.Text = "Wed" Then
For i = 0 To 25
If wedtext(i).Text = Label4.Caption Then
lbMessage.Caption = "TIME"
Shell ("c:\Program Files\Winamp\winamp.exe E:\Musci\Door_bell.mid")
Else
lbMessage.Caption = "Wednesday"
End If
Next i
End If

If Text1.Text = "Thu" Then
For i = 0 To 25
If thutext(i).Text = Label4.Caption Then
lbMessage.Caption = "TIME"
Shell ("c:\Program Files\Winamp\winamp.exe E:\Musci\Door_bell.mid")
Else
lbMessage.Caption = "Thursday"
End If
Next i
End If

If Text1.Text = "Fri" Then
For i = 0 To 25
If fritext(i).Text = Label4.Caption Then
lbMessage.Caption = "TIME"
Shell ("c:\Program Files\Winamp\winamp.exe E:\Musci\Door_bell.mid")
Else
lbMessage.Caption = "Friday"
End If
Next i
End If

End Sub

Private Sub Timer1_Timer()

Label4.Caption = Time
Text1.Text = Format(Date, "ddd")

End Sub


Its done a ok

This article has been dead for over six months. Start a new discussion instead.