Program Penghitung (Kalkulator) dengan Visual Basic

Jumat, 20 Januari 2012 Published by Unknown

Program Penghitung  dengan Visual Basic
   Sekedar untuk latihan atau coba-coba bagi yang ingin belajar bahasa pemrograman visual basic(vb),  langsung saja mempraktekkan kode program yang ada di bawah ini.

Setelah membuat tampilan seperti di atas, langsung sedot aja kodingnya ^_^



Private Sub Command1_Click()
Text1.Text = 0
Text2.Text = 0
Text3.Text = 0
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Command3_Click()
Dim a As Single
Dim b As Single
Dim c As Single
a = Text1.Text
b = Text2.Text
If Option1.Value = True Then
c = a + b
Text3.Text = c
End If
If Option2.Value = True Then
c = a - b
Text3.Text = c
End If
If Option3.Value = True Then
c = a * b
Text3.Text = c
End If
If Option4.Value = True Then
c = a / b
Text3.Text = c
End If
If Option5.Value = True Then
c = a \ b
Text3.Text = c
End If
If Option6.Value = True Then
c = a ^ b
Text3.Text = c
End If
If Option7.Value = True Then
c = a & b
Text3.Text = c
End If
If Option8.Value = True Then
c = a Mod b
Text3.Text = c
End If
End Sub

Private Sub Form_Activate()
Text1.Text = 0
Text2.Text = 0
Text3.Text = 0
End Sub

No responses yet

Leave a Reply

Diberdayakan oleh Blogger.

Followers