Assalumualaikum Wr. Wb.
Salam Sejahtera Untuk kita semua.!
Untuk Pembahasan kali ini , saya akan mencoba membahas tentang
pemrogramn dengan menggunakan bahasa visual basic atau yg lebih dikenal dg
"VB". dan yg akan sy bhas d postingan ini yaitu 'VB6.0' .tentang
bagaimana membuat sebuah program aplikasi sederhana. yaitu kalkulator
sederhana.
contoh form :
contoh
: konfirmasi keluar
contoh
: source code
Private Sub ckeluar_Click()
p = MsgBox("Anda Yakin Ingin Keluar",
vbQuestion + vbOKCancel, "Informasi")
If p = vbOK Then
End
Else
Kalkulator.Show
txtn1.Text = ""
txtn2.Text = ""
txthasil.Text = ""
txtn1.SetFocus
End If
End Sub
Private Sub cmdbagi_Click()
txthasil.Text = Val(txtn1.Text) /
Val(txtn2.Text)
End Sub
Private Sub cmdkali_Click()
txthasil.Text = Val(txtn1.Text) *
Val(txtn2.Text)
End Sub
Private Sub cmdlagi_Click()
txtn1.Text = ""
txtn2.Text = ""
txthasil.Text = ""
txtn1.SetFocus
End Sub
Private Sub cmdminus_Click()
txthasil.Text = Val(txtn1.Text) -
Val(txtn2.Text)
End Sub
Private Sub cmdplus_Click()
txthasil.Text = Val(txtn1.Text) +
Val(txtn2.Text)
End Sub
Private Sub Timer1_Timer()
label1.ForeColor = RGB(Rnd * 250, Rnd * 250,
Rnd * 250)
End Sub
Private Sub txtn1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtn2.SetFocus
End If
If Not (KeyAscii >= Asc("0") And
KeyAscii <= Asc("9") Or _
KeyAscii = vbKeyBack) Then
Beep
KeyAscii = 0
End If
End Sub
Private Sub txtn2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdplus.SetFocus
End If
If Not (KeyAscii >= Asc("0") And
KeyAscii <= Asc("9") Or _
KeyAscii = vbKeyBack) Then
Beep
KeyAscii = 0
End If
End Sub
untuk
selengkapnya bisa download [[[Disini]]]
jiak
ada yg kurang jelas bisa langsung tuliskan komentar teman2 di kolom komentar.
Thx
Wassalamualaikum
Wr.Wb
0 comments:
Post a Comment