You are on page 1of 41

Memahami

Pemrograman Visual
Berbasis Desktop

I Made Purnama Yasa, S.Kom

YM: tubbies_bali@yahoo.co.id
Blog: http://purnamayasa.wordpress.com
HP: 081 338 570 641

24/08/2010
Pertemuan 5
Materi Pembelajaran

• DriveListBox
• DirListBox
• FileListBox

24/08/2010
Program DriveListBox,
DirListBox & FileListBox

24/08/2010
Posisi DriveListBox, DirListBox
& FileListBox pada ToolBox

DirListBox
DriveListBox

FileListBox

24/08/2010
Langkah 1
Membuat Desain Form
Utama

24/08/2010
Label

DriveListBox

DirListBox

CommandButton FileListBox
24/08/2010
Langkah 2
Mengatur Properties Objek
Form Utama

24/08/2010
Properties Value
Name frmUtama
Caption DriveListBox,
DirListBox &
FileListBox
BorderStyle 1 – Fixed Single
StartUpPosition 2-
CenterScreen

24/08/2010
Properties Value
Name Label1
Caption Program Penampil Gambar
24/08/2010
Properties Value
Name cmdKeluar
Caption Keluar

Properties Value
Name cmdAbout
24/08/2010 Caption About
Properties Value
Name File1
Pattern *.jpg;*.gif;*.bm
p

Properties Value
Name Drive1 Properties Value
Name Dir1
24/08/2010
Langkah 3
Menambahkan Form Baru
Untuk About

24/08/2010
Pilih menu Project  Add Form

24/08/2010
Langkah 4
Membuat Desain Form
About

24/08/2010
Label

Label

CommandButton

24/08/2010
Langkah 5
Mengatur Properties Objek
Form About

24/08/2010
Properties Value
Name frmAbout
Caption About...
BorderStyle 1 – Fixed Single
StartUpPosition 2 -
CenterScreen

24/08/2010
Properties Value
Name Label1
Alignment 2 – Center
Caption Oleh :

Properties Value
Name Label2 Properties Value
Alignment 2 – Center Name cmdKeluar
Caption I Made Purnama Caption Keluar
Yasa

24/08/2010
Langkah 6
Membuat Desain Form
Gambar

24/08/2010
Image

24/08/2010
Langkah 7
Mengatur Properties Objek
Form Gambar

24/08/2010
Properties Value
Name frmGambar
Caption Lihat Gambar
BorderStyle 1 – Fixed Single
StartUpPosition 2 -
CenterScreen

24/08/2010
Properties Value
Name Image1
Stretch True

24/08/2010
Langkah 8
Membuat Kode Program
Form Utama

24/08/2010
Klik 2 (dua) kali pada Drive1

24/08/2010
Ketikkan Perintah Berikut

Private Sub Drive1_Change()


Dir1.Path = Drive1.Drive
End Sub

24/08/2010
Klik 2 (dua) kali pada Dir1
24/08/2010
Ketikkan Perintah Berikut

Private Sub Dir1_Change()


File1.Path = Dir1.Path
End Sub

24/08/2010
Klik 2 (dua) kali pada File1
24/08/2010
Pilih Event DblClick
24/08/2010
Ketikkan Perintah Berikut

Private Sub File1_DblClick()


' Pendeklarasian variabel
Dim MyForm As New frmGambar

' Len, digunakan untuk menghitung panjang karakter


If Len(File1.FileName) > 0 Then
MyForm.Image1.Picture = LoadPicture(Dir1.Path &
"\" & File1.FileName)
MyForm.Show
End If
End Sub

24/08/2010
Klik 2 (dua) kali pada Tombol About

24/08/2010
Ketikkan Perintah Berikut

Private Sub cmdAbout_Click()


frmAbout.Show vbModal
End Sub

24/08/2010
Klik 2 (dua) kali pada Tombol Keluar

24/08/2010
Ketikkan Perintah Berikut

Private Sub cmdKeluar_Click()


End
End Sub

24/08/2010
Langkah 9
Membuat Kode Program
Form About

24/08/2010
Klik 2 (dua) kali pada Tombol Keluar

24/08/2010
Ketikkan Perintah Berikut

Private Sub cmdKeluar_Click()


Unload Me
End Sub

24/08/2010
Langkah 10
Run Program

24/08/2010
Tanya Jawab

24/08/2010
Selesai

24/08/2010

You might also like