1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Visual Basic Compile Errors

Discussion in 'Software Development' started by Rhino24, Mar 27, 2008.

Thread Status:
Not open for further replies.
  1. Rhino24

    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
     
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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/697651

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice