I am getting lstBox is not declared and lbl1 is not declared but I named them in the form as that. Can anyone tell me how to fix this problem.
Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click
End Sub
Private Sub Command1_Click()
'input variables from user
Dim A%, B%, C%, X%, Y%
Dim num1 As Integer
A = Val(T1.Text)
B = Val(T2.Text)
C = Val(T3.Text)
If (num1 <= 0 Or num1 > 30) Then 'tests textbox 1
T1.Text = "0"
End If
If (num1 <= 0 Or num1 > 30) Then 'test textbox 2
T2.Text = "0"
End If
If (num1 <= 0 Or num1 > 30) Then 'test textbox 3
T3.Text = "0"
End If
If lstBox.ListIndex = 0 Then ' finds the sum
lbl1.Caption = A + B + C
ElseIf lstBox.ListIndex = 1 Then 'finds the product
lbl1.Caption = A * B * C
ElseIf lstBox.ListIndex = 2 Then 'finds the average
lbl1.Caption = A + B + C / 3
ElseIf lstBox.ListIndex = 3 Then ' finds smallest number
If A > B And A > C Then
X = A
ElseIf B > C Then
X = B
Else
X = C
End If
lbl1.Caption = X
ElseIf lstBox.ListIndex = 4 Then ' finds largest number
If A < B And A < C Then
Y = A
ElseIf B < C Then
Y = B
Else
Y = C
End If
lbl1.Caption = Y
End If
End Sub
End Class
Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click
End Sub
Private Sub Command1_Click()
'input variables from user
Dim A%, B%, C%, X%, Y%
Dim num1 As Integer
A = Val(T1.Text)
B = Val(T2.Text)
C = Val(T3.Text)
If (num1 <= 0 Or num1 > 30) Then 'tests textbox 1
T1.Text = "0"
End If
If (num1 <= 0 Or num1 > 30) Then 'test textbox 2
T2.Text = "0"
End If
If (num1 <= 0 Or num1 > 30) Then 'test textbox 3
T3.Text = "0"
End If
If lstBox.ListIndex = 0 Then ' finds the sum
lbl1.Caption = A + B + C
ElseIf lstBox.ListIndex = 1 Then 'finds the product
lbl1.Caption = A * B * C
ElseIf lstBox.ListIndex = 2 Then 'finds the average
lbl1.Caption = A + B + C / 3
ElseIf lstBox.ListIndex = 3 Then ' finds smallest number
If A > B And A > C Then
X = A
ElseIf B > C Then
X = B
Else
X = C
End If
lbl1.Caption = X
ElseIf lstBox.ListIndex = 4 Then ' finds largest number
If A < B And A < C Then
Y = A
ElseIf B < C Then
Y = B
Else
Y = C
End If
lbl1.Caption = Y
End If
End Sub
End Class