• 0

VB Programing help


Question

2 answers to this question

Recommended Posts

  • 0

Well, First, I think you need to rethink the way your IFs are set up. For this, i'd try nesting them, to simplify reading it.

For example:

If Not False Then

If True And True then

End If

If True And True then

End If

End If

Second, the variables sat, gpa, and age aren't even initialized! :D

Link to comment
Share on other sites

  • 0

yeah, youre if statements are completely screwed up.

the first thing you need to do is set up your ifs based on the selected text... the way you have it right now is so totally screwed up i dont even know how you came up with it...

use one of these

   Select Case LCase(listbox1.Text)
        Case ""
            MsgBox "Select a species"
            Exit Sub
        Case "romulan"
            MsgBox "you are not admitted"
            Exit Sub
        Case "vulcan"
        Case "klingon"
        Case "human"
    End Select
    
    If LCase(listbox1.Text) = "" Then
        MsgBox "select a species"
    ElseIf LCase(listbox1.Text) = "romulan" Then
        MsgBox "you are not admitted"
        Exit Sub
    ElseIf LCase(listbox1.Text) = "vulcan" Then
    ElseIf LCase(listbox1.Text) = "klingon" Then
    ElseIf LCase(listbox1.Text) = "human" Then
    End If

then for each species under the if/case statement is where you use your stuff..

   ElseIf LCase(listbox1.Text) = "vulcan" Then
        If age < 16 Then
            MsgBox "not old enough"
            Exit Sub
        End If

etc

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.