Monday, 27 April 2015

Cara membuat kalkulator di Visual Basic dengan ComboBox

Turmudi


Selamat Datang di Blog saya.....

Saya akan memposting bagaimana caraya untuk membuat kalkulator diVisual Basic dengan "ComboBox" .

Langsung Saja....!!
1. Buka Visual Basic
2.Buat Formnya
3.Buat Label,TextBox, dan ComboBox
4. Tulis Kodingnya .

Dobel Klik ComboBox-nya dan tulis koding dibawah ini :
 
Private Sub Combo1_Click()
If Combo1.Text = "+" Then
    Text3.Text = Val(Text1.Text) + Val(Text2.Text)
Else
   If Combo1.Text = "-" Then
    Text3.Text = Val(Text1.Text) - Val(Text2.Text)
    Else
        If Combo1.Text = "/" 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

Untuk tombol hapus

Text1.text = Clear
Text2.text = Clear
Text3.text = Clear

Untuk tombol Keluar/Exit

End

Contoh Tampilan :


Terima Kasih
Semoga Bermanfaat....

0 comments:

Post a Comment