Tugas 1.5 Membuat Kalkulator Menggunakan Visual Basic 6.0 ( Click Button + KeyAscii)

Tugas 1.5 Membuat Kalkulator menggunakan Visual Basic 6.0 ( Dengan klik tombol hitung dan menggunakan keypress / KeyAscii )

Gambar. Runtime Aplikasi Kalkulator VB 6.0

Berikut merupakan source code dari kalkulator :

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 Txtn11_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    Hitung.SetFocus
    Txthasil = Val(Txtn1) * Val(Txtn2)
    Txtjumlah = Val(Txtn4) + Val(Txtn5)
    Txtkurang = Val(Txtn7) - Val(Txtn8)
    Txtbagi = Val(Txtn10) / Val(Txtn11)
    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

Related Posts:

0 Response to "Tugas 1.5 Membuat Kalkulator Menggunakan Visual Basic 6.0 ( Click Button + KeyAscii)"

Posting Komentar