Laporan tugas akhir ini membahas tentang pembuatan aplikasi adzan sederhana menggunakan bahasa pemrograman Visual Basic. Aplikasi ini dapat memainkan rekaman adzan pada waktu yang telah disetel sebelumnya dan memiliki fitur penguncian waktu untuk mencegah perubahan. Ringkasan kode program menjelaskan penggunaan komponen seperti label, tombol, dan pemutar media untuk menampilkan dan memainkan file suara adzan sesu
2. 1
X RPL 2
BAB I
PENDAHULUAN
1.1 Mengenal Microsoft Visual Basic
Visual Basic adalah salah satu bahasa pemprograman computer. Bahasa
pemprograman adalah perintah yang dimengerti oleh computer untuk
melakukan tugas-tugas tertentu. Bahasa pemprograman Visual Basic
dikembangkan oleh Microsoft sejak tahun 1991. Visual Basic merupakan
salah satu Development Tool yaitu alat bantu untuk memebuat berbagai
macam program computer. Visula Basic merupakan salah satu bahasa
pemprograman komputer yang mendukung Object Orienteted Programing.
1.2 Mengenal Integrated Development Environment (IDE) VB 6
Jalankan Microsoft Visual Basic dengan cara, klik Start Menu > All Programs
> Microsoft Visual Studio 6.0 > Microsoft Visual Basic 6.0.
Lalu akan muncul tampilan seperti berikut :
3. 2
Pilih “Standard EXE” lalu klik “Open”.
Lalu akan muncul tampilan seperti gambar berikut :
Keterangan :
4. 3
- Menubar
-Toolbar
- Toolbox
Bila Toolbox tidak muncul klik tombol Toolbox ( ) pada bagian Toolbar
atau klik menu View > Toolbox.
- Jendela Form
Bila Jendela Form tidak muncul klik tombol View Object ( ) pada bagian
Project Explorer atau klik menu View > Object.
- Jendela Code
Bila Jendela Code tidak muncul klik tombol View Code ( ) di pada bagian
Project Explorer atau klik menu View > Code.
- Project Explorer
Bila Project Explorer tidak muncul klik tombol Project Explorer ( ) pada
bagian Toolbar atau klik menu View > Project Explorer.
-Jendela Properties
Bila Jendela Properties tidak muncul klik tombol Properties Window ( )
pada bagian Toolbar atau klik menu View > Properties Window.
1.3 Memahami Istilah Object, Property, Method dan Event.
Dalam pemrograman berbasis obyek (OOP), anda perlu memahami istilah
object, property, method dan event sebagai berikut :
-Object : komponen di dalam sebuah program.
-Property : karakteristik yang dimiliki object.
-Method : aksi yang dapat dilakukan oleh object.
-Event : kejadian yang dapat dialami oleh object.
5. 4
BAB II
MEMBUAT APLIKASI ADZAN SEDERHANA
1. Jalankan Microsoft Visual Basic dengan cara, klik Start Menu > All Programs >
Microsoft Visual Studio 6.0 > Microsoft Visual Basic 6.0.
2. Lalu akan muncul tampilan seperti berikut. Pilih “Standard EXE” dan klik
“Open”.
7. 6
4. Gunakan komponen Label, Text Boxt, Frame, Command Button, Windows
Media Player, Timer dan Menu Editor. Lalu buat seperti gambar berikut.
5. Lalu ubah property object seperti berikut :
8. 7
Object Property Value
Form
Caption Aplikasi Adzan
Back Color &H0080FF80& (Green)
Start-Up Position Center Owner
Label 1
Name Label1
Caption Aplikasi Adzan
Label 2
Name Label2
Caption Alarm Ulock
Label 3
Name Label3
Caption 00:00:00
Label 4
Name Label4
Caption Subuh
Label 5
Name Label5
Caption Dzuhur
Label 6
Name Label6
Caption Asar
Label 7
Name Label7
Caption Maghrib
Label 8
Name Label8
Caption Isya
Command Button 1
Name Command1
Caption ON
Command Button 2
Name Command2
Caption EXIT
Command Button 3
Name Command3
Caption LOCK
Command Button 4
Name Command4
Caption UNLOCK
Timer
Name Timer1
Interval 1000
Enabled True
9. 8
Object Property Value
Frame
Name Frame1
Caption Kunci Jam
Windows Media Player Name WindowsMediaPlayer
Text Box 1
Name Text1
Caption -
Text Box 2
Name Text2
Caption -
Text Box 3
Name Text 3
Caption -
Text Box 4
Name Text 4
Caption -
Text Box 5
Name Text5
Caption -
6. Lalu pilih menu View > Code dan tampilan berubah menjadi seperti berikut.
7. Lalu masukan code berikut.
10. 9
Dim alarem As Boolean
Private Sub Command1_Click()
If alarem = True Then
Timer1.Enabled = False
Command1.Caption = "ON"
alarem = False
Else
Command1.Caption = "OFF"
alarem = True
End If
End Sub
Private Sub Command2_Click()
If MsgBox("Do you want Exit?", vbOKCancel, "Exit") = vbOK Then
End
End If
End Sub
Private Sub Command3_Click()
Text1.Locked = True
Text2.Locked = True
Text3.Locked = True
Text4.Locked = True
Text5.Locked = True
Label2.Caption = "ALARM LOCK"
Command4.Enabled = True
Command3.Enabled = False
End Sub
Private Sub Command4_Click()
Text1.Locked = False
Text2.Locked = False
Text3.Locked = False
Text4.Locked = False
Text5.Locked = False
Label2.Caption = "ALARM UNLOCK"
Command4.Enabled = False
Command3.Enabled = True
End Sub
Private Sub Command5_Click()
11. 10
Form2.Show
End Sub
Private Sub Form_Load()
alarem = False
End Sub
Private Sub Timer1_Timer()
Label3.Caption = Time
If Text1.Text = Label3.Caption And alarem = True Then
WindowsMediaPlayer1.URL = App.Path & "adzan subuh.mp3"
WindowsMediaPlayer1.Enabled = True
WindowsMediaPlayer1.Controls.play
End If
If Text2.Text = Label3.Caption And alarem = True Then
WindowsMediaPlayer1.URL = App.Path & "adzan.mp3"
WindowsMediaPlayer1.Enabled = True
WindowsMediaPlayer1.Controls.play
End If
If Text3.Text = Label3.Caption And alarem = True Then
WindowsMediaPlayer1.URL = App.Path & "adzan.mp3"
WindowsMediaPlayer1.Enabled = True
WindowsMediaPlayer1.Controls.play
End If
If Text4.Text = Label3.Caption And alarem = True Then
WindowsMediaPlayer1.URL = App.Path & "adzan.mp3"
WindowsMediaPlayer1.Enabled = True
WindowsMediaPlayer1.Controls.play
End If
If Text5.Text = Label3.Caption And alarem = True Then
WindowsMediaPlayer1.URL = App.Path & "adzan.mp3"
WindowsMediaPlayer1.Enabled = True
WindowsMediaPlayer1.Controls.play
End If
End Sub
Private Sub tool1_Click()
Form3.Show
End Sub
Private Sub tool2_Click()
Form2.Show
End Sub
12. 11
Private Sub tool5_Click()
Form4.Show
Unload Me
End Sub
Private Sub tool6_Click()
Bgcolor = "Red"
End Sub
8. Lalu jalankan (Run) program dengan cara menekan tombol “f5” pada
keyboard anda atau dengan cara mengklik tombol Play. Dan berikut Output
program yang telah anda buat.