

Lalu copy listing program dibawah ini:
Dim a As Integer Dim b As Integer Dim c As Variant Private Sub Cmd_6239_Click() If Txt1_6239.Text = "" And Txt2_6239.Text = "" Then MsgBox "Anda belum masukkan angka", vbOKOnly + vbInformation, "INFORMASI" If vbYes Then Exit Sub End If If Txt1_6239.Text = "" Then MsgBox "Anda belum masukkan angka pertama", vbOKOnly + vbInformation, "INFORMASI" If vbYes Then Exit Sub End If If Txt2_6239.Text = "" Then MsgBox "Anda belum masukkan angka kedua", vbOKOnly + vbInformation, "INFORMASI" If vbYes Then Exit Sub End If If Cmb1_6239.Text = "Pilihan" Then MsgBox "Anda belum menentukan pilihan", vbOKOnly + vbInformation, "INFORMASI" If vbYes Then Exit Sub End If a = Txt1_6239 b = Txt2_6239 If Cmb1_6239.ListIndex = 0 Then c = a * b ElseIf Cmb1_6239.ListIndex = 1 Then c = a / b ElseIf Cmb1_6239.ListIndex = 2 Then c = a + b Else c = a - b End If Txt3_6239 = c End Sub Private Sub Txt1_6239_KeyPress(KeyAscii As Integer) If KeyAscii = vbKeyBack Then Exit Sub If KeyAscii <> 57 Then KeyAscii = 0 MsgBox "Anda Tidak Boleh Masukkan Huruf", vbOKOnly + vbInformation, "INFORMASI" End If End Sub Private Sub Txt2_6239_KeyPress(KeyAscii As Integer) If KeyAscii = vbKeyBack Then Exit Sub If KeyAscii <> 57 Then KeyAscii = 0 MsgBox "Anda Tidak Boleh Masukkan Huruf", vbOKOnly + vbInformation, "INFORMASI" End If End Sub |
Berikut hasil akhir tampilan dari program kalkulator sederhana yg siap untuk digunakan.
No comments:
Post a Comment
Please leave your message here..