Sabtu, 01 Februari 2014

Membuat Aplikasi Kalkulator Paling Sederhana Menggunakan VB 6.0

MEMBUAT APLIKASI KALKULATOR PALING SEDERHANA MENGGUNAKAN VB 6.0




 


 buat seperti di atas ato terserah lah mau buat model kaya mna asal comond buttonya ada 15, text boxnya ada 3 dan 1 label..
di bawah ini codingnya..

Dim stt, stt2 As String

Private Sub Command1_Click()
If stt = "T" Then
Text1.Text = 7
Else
If stt2 = "T" Then
Text2.Text = 7
End If
End If

End Sub

Private Sub Command10_Click()
If stt = "T" Then
Text1.Text = 0
Else
If stt2 = "T" Then
Text2.Text = 0
End If
End If
End Sub

Private Sub Command11_Click()
Label1.Caption = "+"

End Sub

Private Sub Command12_Click()
Label1.Caption = "/"
End Sub

Private Sub Command13_Click()
Label1.Caption = "*"
End Sub


Private Sub Command14_Click()
Label1.Caption = "-"
End Sub

Private Sub Command15_Click()
If Label1.Caption = "+" Then
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
Else
If Label1.Caption = "-" Then
Text3.Text = Val(Text1.Text) - Val(Text2.Text)
Else
If Label1.Caption = "*" Then
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
Else
Text3.Text = Val(Text1.Text) / Val(Text2.Text)
End If
End If
End If

End Sub

Private Sub Command2_Click()
If stt = "T" Then
Text1.Text = 8
Else
If stt2 = "T" Then
Text2.Text = 8
End If
End If

End Sub



Private Sub Command3_Click()
If stt = "T" Then
Text1.Text = 9
Else
If stt2 = "T" Then
Text2.Text = 9
End If
End If
End Sub

Private Sub Command4_Click()
If stt = "T" Then
Text1.Text = 4
Else
If stt2 = "T" Then
Text2.Text = 4
End If
End If
End Sub

Private Sub Command5_Click()
If stt = "T" Then
Text1.Text = 5
Else
If stt2 = "T" Then
Text2.Text = 5
End If
End If
End Sub

Private Sub Command6_Click()
If stt = "T" Then
Text1.Text = 6
Else
If stt2 = "T" Then
Text2.Text = 6
End If
End If
End Sub

Private Sub Command7_Click()
If stt = "T" Then
Text1.Text = 1
Else
If stt2 = "T" Then
Text2.Text = 1
End If
End If
End Sub

Private Sub Command8_Click()
If stt = "T" Then
Text1.Text = 2
Else
If stt2 = "T" Then
Text2.Text = 2
End If
End If
End Sub

Private Sub Command9_Click()
If stt = "T" Then
Text1.Text = 3
Else
If stt2 = "T" Then
Text2.Text = 3
End If
End If

End Sub


Private Sub Text1_click()
stt = "T"
stt2 = "F"
End Sub

Private Sub Text2_Click()
stt = "F"
stt2 = "T"
End Sub

ini lah hasil jadinya...


  
 
 selamat mencoba..  :)  Kalo berhasil Kasi SS ya :v

Tidak ada komentar:

Posting Komentar