Kalkulator Ringkas
#coding
Public Class Form2
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
TextBox2.Focus()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ComboBox1.Text = "+" Then
TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
ElseIf ComboBox1.Text = "-" Then
TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
ElseIf ComboBox1.Text = "*" Then
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
ElseIf ComboBox1.SelectedText = "/" Then
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
ElseIf ComboBox1.Text = "%" Then
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text) / 100
End If
End Sub
End Class
