I use Visual Studio using language: VB in the case to run my code I come up with this errors:
- (8:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (9:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (9:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (11:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (12:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (12:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (14:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (15:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (15:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (17:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (18:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (18:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (20:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (21:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (21:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (23:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (24:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (24:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (26:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (27:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (27:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (29:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (30:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (30:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (32:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (33:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (33:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (35:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (36:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (36:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (38:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (39:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (39:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (41:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (42:0) 'Val' is not declared. It may be inaccessible due to its protection level.
- (42:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (43:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (46:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (47:0) 'Val' is not declared. It may be inaccessible due to its protection level.
- (47:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (48:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (51:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (52:0) 'Val' is not declared. It may be inaccessible due to its protection level.
- (52:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (53:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (56:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (57:0) 'Val' is not declared. It may be inaccessible due to its protection level.
- (57:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (58:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (61:0) Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
- (62:0) 'Val' is not declared. It may be inaccessible due to its protection level. -(62:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
- (75:0) 'TextBox1' is not declared. It may be inaccessible due to its protection level.
I tried to run this code:
Public Class Form1
Dim firstNumber As Single
Dim secondNumber As Single
Dim answerNumber As Single
Dim arithmeticprocess As String
Private Sub button1_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = TextBox1.Text & 1
End Sub
Private Sub button2_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = TextBox1.Text & 2
End Sub
Private Sub button3_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = TextBox1.Text & 3
End Sub
Private Sub button4_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
TextBox1.Text = TextBox1.Text & 4
End Sub
Private Sub button5_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
TextBox1.Text = TextBox1.Text & 5
End Sub
Private Sub button6_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
TextBox1.Text = TextBox1.Text & 6
End Sub
Private Sub button7_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
TextBox1.Text = TextBox1.Text & 7
End Sub
Private Sub button8_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
TextBox1.Text = TextBox1.Text & 8
End Sub
Private Sub button9_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
TextBox1.Text = TextBox1.Text & 9
End Sub
Private Sub button10_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
TextBox1.Text = TextBox1.Text & 0
End Sub
Private Sub button11_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
TextBox1.Text = TextBox1.Text & " . "
End Sub
Private Sub button12_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
firstNumber = Val(TextBox1.Text)
TextBox1.Text = "0"
arithmeticprocess = "+"
End Sub
Private Sub button13_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
firstNumber = Val(TextBox1.Text)
TextBox1.Text = "0"
arithmeticprocess = "-"
End Sub
Private Sub button14_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
firstNumber = Val(TextBox1.Text)
TextBox1.Text = "0"
arithmeticprocess = "*"
End Sub
Private Sub button15_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
firstNumber = Val(TextBox1.Text)
TextBox1.Text = "0"
arithmeticprocess = "/"
End Sub
Private Sub button16_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
secondNumber = Val(TextBox1.Text)
If arithmeticprocess = "+" Then
answerNumber = firstNumber + secondNumber
End If
If arithmeticprocess = "-" Then
answerNumber = firstNumber + secondNumber
End If
If arithmeticprocess = "*" Then
answerNumber = firstNumber + secondNumber
End If
If arithmeticprocess = "/" Then
answerNumber = firstNumber + secondNumber
End If
TextBox1.Text = answerNumber
End Sub
End Class