Cara Buat Program Alarm dengan VB 6

1. Buka VB6 , project baru(standard exe).
2. Tambahkan component baru (project-component atau Ctrl+T),tambahkan Microsoft Common Dialog Control 6.0,centang,apply,dan close

3. Tambhalan beberapa tool.(tool /property)
label
label1/caption = alarm
label2/caption = time now
label3/caption = time to set
label4/caption = –
label5/caption = alarm time
label6/caption = “kosongkan”/visible = false
text box

text1/text = “kosongkan”
text2/text = “kosongkan”
text3/text = “kosongkan”

text5/text = “kosongkan” /multiline = true/scrollbar = 3-both
commands
command1/caption = Set
commann2/caption = clear
command3/caption = open sound file
timer
timer1/interval = 1000

4. Kalo udah menambahkan tinggal diatur/didesain sehingga tampil seperti screen shoot di atas(gak sama juga gak papa).
Double klik form dah ubah posisinya menjadi di general lalus masukan script ini :
Private Declare Function PlaySound Lib “winmm.dll” Alias “PlaySoundA” (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
5. Double klik pada command open sound file,masukan script ini :
CommonDialog1.Filter = “(*.wav)|*.wav|”
CommonDialog1.ShowOpen
Label

6.Caption = CommonDialog1.FileName

7. Double klik text1 dan rubah actionsnya menjadi keypress dan masukan script ini:
If Not (KeyAscii >= Asc(“0″) And KeyAscii <= Asc(“9″)) Then
MsgBox “Inputan harus berupa angka”, vbCritical, “ERROR”
Text1.Text = Empty
Text1.SetFocus
KeyAscii = 0
End If
If Len(Text1.Text) = 1 Then Text2.SetFocus
8. Pada text2 dan 3 sama seperti diatas hanya diganti pada text1 dan focusnya.
9. Double clik command clear dan masukan script berikut :
Text1.Text = Empty
Text2.Text = Empty
Text3.Text = Empty
Text5.Text = Empty
Text5.Locked = False
Label4.Caption = “-”
Text1.SetFocus

10. Double klik timer dan masukan script ini :
Dim returnval As Long
Dim soundfile As String
Label1.Caption = Format(Now, “hh:mm:ss”)
If Label1.Caption = Label4.Caption Then
soundfile = Label6.Caption
returnval = PlaySound(soundfile, 0, &H0)
MsgBox Text5.Text, vbInformation, “PESAN”
End If
11. Double klik pada command set dan masukan script berikut:
Dim a As String
a = Text1.Text + “:” + Text2.Text + “:” + Text3.Text
Label4.Caption = a
Text5.Locked = True
12. Selesai dah..Mudah dan sederhana bukan.

http://mrmind13.blogspot.com/2009/07/alarm-with-vb6.html

About GrafikMultimedia
Ivan adalah pengguna wordpress.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: