Public Class Form1
Enum operations
none = 0
add = 1
substract = 2
multiply = 3
divide = 4
End Enum
Dim operation
Dim n As Double
Dim n2 As Double
Private Sub calcul()
If TextBox1.Text <> "" Then
Select Case operation
Case operations.add
n = n + Val(TextBox1.Text)
Case operations.substract
n = n - Val(TextBox1.Text)
Case operations.multiply
n = n * Val(TextBox1.Text)
Case operations.divide
n = n / Val(TextBox1.Text)
Case Else
n = Val(TextBox1.Text)
End Select
End If
operation = operations.none
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
TextBox1.Text &= "9"
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
operation = operations.none
n = 0
n2 = 0
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text &= "1"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text &= "2"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text &= "3"
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
TextBox1.Text &= "4"
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
TextBox1.Text &= "5"
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
TextBox1.Text &= "6"
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
TextBox1.Text &= "7"
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
TextBox1.Text &= "8"
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
TextBox1.Text &= "0"
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
'Butonul C
n = 0
TextBox1.Text = ""
operation = operations.none
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
'Butonul =
calcul()
TextBox1.Text = n
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
'Butonul +
calcul()
TextBox1.Text = ""
operation = operations.add
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
'Butonul -
calcul()
TextBox1.Text = ""
operation = operations.substract
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
'Butonul *
calcul()
TextBox1.Text = ""
operation = operations.multiply
End Sub
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
'Butonul /
calcul()
TextBox1.Text = ""
operation = operations.divide
End Sub
Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
'Butonul .
If TextBox1.Text <> "" And Not TextBox1.Text.Contains(".") Then
TextBox1.Text &= "."
End If
Dim Имя As String
Имя = "Билл"
Если Имя = "Билл" Then MsgBox ("Имя Билл")
End Sub
Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
'Butonul +/-
TextBox1.Text = -Val(TextBox1.Text)
End Sub
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
End Sub
Private Sub Form1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
End Sub
Private Sub Form1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class