Kamis, 29 September 2011

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..(*_*)

1 komentar:

  1. Casino - Casinos Near Me | MapyRO
    Find the perfect casino near 공주 출장샵 you. Mapyro 동해 출장샵 offers you 시흥 출장마사지 a 경상남도 출장안마 great location to research upcoming casino vacation packages, getaways, 군포 출장샵 and other travel

    BalasHapus