User Tag List

Results 1 to 7 of 7

Thread: For those who know a bit about Visual Basics Prgramming!!

  1. #1
    Patra Drunken Tiger's Avatar
    Join Date
    Nov 2001
    Location
    Made in USA Exported to Australia
    Age
    37
    Posts
    7,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    9,088
    Level
    28
    vBActivity - Bars
    Lv. Percent
    63.56%

    Question For those who know a bit about Visual Basics Prgramming!!

    Private Sub cmd_ok_Click()
    'This checks that the login name and password is correct'
    If txb_login <> "DT" Then
    MsgBox "Incorrect Login Name"
    Else
    txb_password = ""
    txb_login.SetFocus

    'If login name is correct it will continue to check the password'
    If txb_password <> "AGN" Then
    MsgBox " Incorrect Password"
    Else
    txb_password = ""
    txb_login.SetFocus

    'When both the login name and password have been verifed it will open the next screen"
    GTA3Open.Show
    txb_password = ""
    Gta3.Hide

    End If
    End If
    End Sub
    Whats wrong!! I always get the "Incorrect Login Name" message!! But I entered the right one in!! Please help me!?!
    This is so draining!!:angry:

  2. #2
    Wizrobe inori's Avatar
    Join Date
    Nov 2001
    Location
    Konan
    Posts
    4,075
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    4,394
    Level
    20
    vBActivity - Bars
    Lv. Percent
    95.27%
    You really should ask this in the Programming forum...

    But as to the answer to your question, three things jump out at me.

    #1: Try running your code in the debugger. Put a breakpoint on the first line of the function and trace through its flow. Just before the if statement executes, check the value of the variable you're testing to make sure it's what you think it is.

    #2: Make sure you're typing your inputs in capital letters. The <> operator requires exact equality, including case, so "AGN" <> "agn".

    #3: On line six, you set the password to "". On line ten, you test the password against "AGN". This test will always fail, because you just set the password to something other than "AGN" four lines ago.


    As the lunatic responsible for its creation, I'm wondering what exactly I was smoking when I came up with it. -- Shadowblazer, referring to the old star system

    My Mage Points: [mp]227[/mp]

  3. #3
    Patra Drunken Tiger's Avatar
    Join Date
    Nov 2001
    Location
    Made in USA Exported to Australia
    Age
    37
    Posts
    7,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    9,088
    Level
    28
    vBActivity - Bars
    Lv. Percent
    63.56%
    #1: Try running your code in the debugger. Put a breakpoint on the first line of the function and trace through its flow. Just before the if statement executes, check the value of the variable you're testing to make sure it's what you think it is.
    Im a newbie at this so i have no idea what you are talking about.. sorry!!

    #2: Make sure you're typing your inputs in capital letters. The <> operator requires exact equality, including case, so "AGN" <> "agn".
    I've done that..
    #3: On line six, you set the password to "". On line ten, you test the password against "AGN". This test will always fail, because you just set the password to something other than "AGN" four lines ago.
    Do you think you can give me an example??




    As i said before.. im a newbie at this!!

  4. #4
    Wizrobe inori's Avatar
    Join Date
    Nov 2001
    Location
    Konan
    Posts
    4,075
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    4,394
    Level
    20
    vBActivity - Bars
    Lv. Percent
    95.27%

    Re: For those who know a bit about Visual Basics Prgramming!!

    Originally posted by DrUnKeN TiGeR
    Code:
    Private Sub cmd_ok_Click()
        'This checks that the login name and password is correct'
        If txb_login <> "DT" Then
            MsgBox "Incorrect Login Name"
        Else
            txb_password = ""  ' This is line six
            txb_login.SetFocus
        
            'If login name is correct it will continue to check the password'
            If txb_password <> "AGN" Then ' This is line ten
                MsgBox " Incorrect Password"
            Else
                txb_password = ""
                txb_login.SetFocus
    
                'When both the login name and password have been verifed it will open the next screen
                GTA3Open.Show
                txb_password = ""
                Gta3.Hide
        
            End If
        End If
    End Sub
    Hey, no problem. I've quoted your code (and put it inside CODE and /CODE tags) so it's easier to refer to.

    See the line I marked as "This is line six"? That line changes txb_password to "" (the empty string). However, just a few lines later (on the line I marked "This is line ten"), you perform the test "txb_password <> "AGN" ". That test will always be true. Why? Well, you just finished changing txb_password to "", and "" <> "AGN".

    Here's another debugging tip: You can add either or both of these two lines anywhere inside your procedure, so you can check the values of the variables you are using. This can help you tell what values your variables really have.
    Code:
        ' This line pops up a message with the value of the txb_login variable
        MsgBox "txb_login = " & txb_login
        ' This line does the same for the txb_password variable
        MsgBox "txb_password = " & txb_password
    Good luck!


    As the lunatic responsible for its creation, I'm wondering what exactly I was smoking when I came up with it. -- Shadowblazer, referring to the old star system

    My Mage Points: [mp]227[/mp]

  5. #5
    Patra Drunken Tiger's Avatar
    Join Date
    Nov 2001
    Location
    Made in USA Exported to Australia
    Age
    37
    Posts
    7,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    9,088
    Level
    28
    vBActivity - Bars
    Lv. Percent
    63.56%
    Thanks alot Inori!! your a lifesaver!!
    Do you do this at school??? Or are you just good at it???

  6. #6
    Wizrobe inori's Avatar
    Join Date
    Nov 2001
    Location
    Konan
    Posts
    4,075
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    4,394
    Level
    20
    vBActivity - Bars
    Lv. Percent
    95.27%
    Well, actually, I get paid to teach computer science. How cool is that? They pay me to do my (second) favorite thing in the whole world! I'm a grad student, and a TA, at UC Berkeley, studying computer science.

    Glad I could be of help. If you have more questions, wander on over to the Programming forum ... there, you will find many others like me who like to answer questions like this one. (Wow, I used the word "like" three times in that sentence...)


    As the lunatic responsible for its creation, I'm wondering what exactly I was smoking when I came up with it. -- Shadowblazer, referring to the old star system

    My Mage Points: [mp]227[/mp]

  7. #7
    Patra Drunken Tiger's Avatar
    Join Date
    Nov 2001
    Location
    Made in USA Exported to Australia
    Age
    37
    Posts
    7,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    9,088
    Level
    28
    vBActivity - Bars
    Lv. Percent
    63.56%
    Cool, and thanks ill most probably take you up on your offer!!:):)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social