Помогите С Калькулятором

  • Автор темы KasimovBakyt
  • Дата начала
K

KasimovBakyt

Гость
#1
Помогите пожалуйста :)
Хочу что бы я набирал числа в одном поле и при нажатий операцию ввел числа в другое поле. Ну и результат на третье поле.
Код:
Public Class Form1
Dim a As Double
Dim b As Double
Public per As Double
Public vtor As Double
Public oper As Integer
Public res As Double

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button1.Text
ElseIf (a = 1) Then
TextBox2.Text = TextBox2.Text & Button1.Text
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button2.Text
ElseIf (a = 1) Then
TextBox2.Text = TextBox2.Text & Button2.Text
End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button3.Text
ElseIf (a = 1) Then
TextBox2.Text = TextBox2.Text & Button3.Text
End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button4.Text
ElseIf (a = 1) Then
TextBox2.Text = TextBox2.Text & Button4.Text
End If
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button5.Text
ElseIf (a = 1) Then
TextBox2.Text = TextBox2.Text & Button5.Text
End If
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button6.Text
ElseIf (a = 1) Then
TextBox2.Text = TextBox2.Text & Button6.Text
End If
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button7.Text
ElseIf (a = 1) Then
TextBox2.Text = TextBox2.Text & Button7.Text
End If
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button8.Text
ElseIf (a = 1) Then
TextBox2.Text = TextBox2.Text & Button8.Text
End If
End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button9.Text
ElseIf (a = 1) Then
TextBox2.Text = TextBox2.Text & Button9.Text
End If
End Sub

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button10.Text
Else (a = 1) Then
TextBox2.Text = TextBox2.Text & Button10.Text
End If
End Sub

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
If (a = 0) Then
TextBox1.Text = TextBox1.Text & Button11.Text
ElseIf (a = 1) Then
TextBox2.Text = TextBox2.Text & Button11.Text
End If
End Sub

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click	 // Это у меня плюс
a = 1
If (a = 1) Then
per = TextBox1.Text
vtor = TextBox2.Text
TextBox3.Text = "+"
res = per + vtor
TextBox4.Text = res
End If
End Sub
End Class
 

Вложения