Membuat
aplikasi sederhana
1.
Buka
Microsoft visual basic 6.0 , kemudian klik open. Buatlah aplikasi dengan menggunakan 2 Label,6
TextBox,dan 6 CommanDialog. Dan susunlah seperti gambar dibawah ini :
Gamba 1 Gambar
2
Dan aturlah propertynya
sebagai berikut !
Nama
|
Property
|
Nilai
|
Label 1
Label 2
|
Caption
Caption
|
Input Nilai A
Input Nilai B
|
Text 1
Text 2
Text 3
Text 4
Text 5
Text 6
|
Name
Text
Name
Text
Name
Text
Name
Text
Name
Text
Name
Text
|
Text1
-
Text2
-
Text3
-
Text4
-
Text5
-
Text6
-
|
CommanDialag1
CommanDialag2
CommanDialag3
CommanDialag4
CommanDialag5
CommanDialag6
|
Caption
Caption
Caption
Caption
Caption
Caption
|
A + B
A – B
A * B
A / B
Clear
Close
|
1.
Kode source
Untuk menulis kodenya, kilk 2 kali pada commandialog.
Private Sub Command1_Click()
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub
Private Sub Command2_Click()
Text4.Text = Val(Text1.Text) - Val(Text2.Text)
End Sub
Private Sub Command3_Click()
Text5.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub
Private Sub Command4_Click()
Text6.Text = Val(Text1.Text) / Val(Text2.Text)
End Sub
Private Sub Command5_Click()
Text1.Text = Clear
Text2.Text = Clear
Text3.Text = Clear
Text4.Text = Clear
Text5.Text = Clear
Text6.Text = Clear
End Sub
Private Sub Command6_Click()
If (MsgBox("Apa anda ingin keluar ?", vbQuestion +
vbYesNo, "Keluar ?") = vbYes) Then
End
End If
End
End Sub
2.
Kemudian
jalankan dengan cara klik Start atau tekan F5 pada keyboard. Dan masukkan angka
yang anda ingin kan, seperti gambar 1 dan hasilnya sperti gambar 2 dibawah ini.
Gambar 1
Gambar
2
3.
Untuk menghapus
angka klik Clear, maka angkanya akan terhapus
Gambar 1