Visual Basic Compile Errors

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Rhino24

Thread Starter
Joined
Feb 8, 2008
Messages
41
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
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top