Membuat kalkulator menggunakan visual basic 6.0 ( untuk menghitungnya harus dengan meng klik tombol hitung yang ada pada aplikasi )
Private Sub Batal_Click()
Txtn1.SetFocus
Txtn1 = ""
Txtn2 = ""
Txtn4 = ""
Txtn5 = ""
Txtn7 = ""
Txtn8 = ""
Txtn10 = ""
Txtn11 = ""
Txthasil = ""
Txtjumlah = ""
Txtkurang = ""
Txtbagi = ""
End Sub
---------------------------------------------------------------------
Private Sub Hitung_Click()
Txthasil = Val(Txtn1) * Val(Txtn2)
Txtjumlah = Val(Txtn4) + Val(Txtn5)
Txtkurang = Val(Txtn7) - Val(Txtn8)
Txtbagi = Val(Txtn10) / Val(Txtn11)
End Sub
---------------------------------------------------------------------
Private Sub Keluar_Click()
End
End Sub
---------------------------------------------------------------------
Private Sub Txtn1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn2.SetFocus
End If
End Sub
--------------------------------------------------------------------
Private Sub Txtn10_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn11.SetFocus
End If
End Sub
--------------------------------------------------------------------
Private Sub Txtn2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn4.SetFocus
End If
End Sub
--------------------------------------------------------------------
Private Sub Txtn4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn5.SetFocus
End If
End Sub
-------------------------------------------------------------------
Private Sub Txtn5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn7.SetFocus
End If
End Sub
-------------------------------------------------------------------
Private Sub Txtn7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn8.SetFocus
End If
End Sub
-------------------------------------------------------------------
Private Sub Txtn8_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn10.SetFocus
End If
End Sub
Gambar. Runtime Aplikasi Kalkulator ( VB 6.0 )
Berikut merupakan source code untuk kalkulator menggunakan VB 6.0 :
Txtn1.SetFocus
Txtn1 = ""
Txtn2 = ""
Txtn4 = ""
Txtn5 = ""
Txtn7 = ""
Txtn8 = ""
Txtn10 = ""
Txtn11 = ""
Txthasil = ""
Txtjumlah = ""
Txtkurang = ""
Txtbagi = ""
End Sub
---------------------------------------------------------------------
Private Sub Hitung_Click()
Txthasil = Val(Txtn1) * Val(Txtn2)
Txtjumlah = Val(Txtn4) + Val(Txtn5)
Txtkurang = Val(Txtn7) - Val(Txtn8)
Txtbagi = Val(Txtn10) / Val(Txtn11)
End Sub
---------------------------------------------------------------------
Private Sub Keluar_Click()
End
End Sub
---------------------------------------------------------------------
Private Sub Txtn1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn2.SetFocus
End If
End Sub
--------------------------------------------------------------------
Private Sub Txtn10_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn11.SetFocus
End If
End Sub
--------------------------------------------------------------------
Private Sub Txtn2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn4.SetFocus
End If
End Sub
--------------------------------------------------------------------
Private Sub Txtn4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn5.SetFocus
End If
End Sub
-------------------------------------------------------------------
Private Sub Txtn5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn7.SetFocus
End If
End Sub
-------------------------------------------------------------------
Private Sub Txtn7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn8.SetFocus
End If
End Sub
-------------------------------------------------------------------
Private Sub Txtn8_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtn10.SetFocus
End If
End Sub
0 Response to "Tugas 1.4 Membuat Kalkulator Menggunakan Visual Basic 6.0 (Bahasa Pemrograman 1)"
Posting Komentar