Results 1 to 7 of 7

Thread: [VB6] Compile Error: Block If without End If

  1. #1
    w_is_awesome's Avatar
    Join Date
    Dec 2011
    Posts
    131
    Userbars
    1
    Thanks
    61
    Thanked 11 Times in 10 Posts
    Downloads
    78
    Uploads
    0
    Mentioned
    12 Post(s)
    Time Online
    20 h 24 m
    Avg. Time Online
    N/A
    Rep Power
    10

    [VB6] Compile Error: Block If without End If

    Ok while testing to see if the my neopets login will work I get this "Compile Error: Block If without End If". How do I fix this.

    Spoiler:

    Private Sub Command1_Click()
    Dim strHTML As String

    strHTML = Wrapper.PostWrapper("http://www.neopets.com/login.phtml", "username=" & txtuser.Text & "&password=" & txtpass.Text & "&destination=%2petcentral.phtml/")

    If InStr(1, strHTML, "badpassword") Then
    Label1.Caption = " Invalid Password/Username "

    If InStr(1, strHTML, "this account has been ") Then
    Label1.Caption = " this account has been frozen "

    If InStr(1, strHTML, "petcentral") Then
    Label1.Caption = " Successful Login "

    Else
    Label1.Caption = " unknown error "

    End Sub
    [Only registered and activated users can see links. ]

  2. #2

    Join Date
    Dec 2011
    Posts
    151
    Userbars
    2
    Thanks
    4
    Thanked 165 Times in 45 Posts
    Downloads
    14
    Uploads
    9
    Mentioned
    68 Post(s)
    Time Online
    6 d 17 h 26 m
    Avg. Time Online
    2 m
    Rep Power
    11
    You have no End If for any If statement and you should use ElseIf for addidtinnal checks. What wrapper are you using, you may want to use a referrer also?

    Code:
    Private Sub Command1_Click()
    Dim strHTML As String
    
    strHTML = Wrapper.PostWrapper("http://www.neopets.com/login.phtml", "username=" & txtuser.Text & "&password=" & txtpass.Text & "&destination=%2petcentral.phtml/")
    
    If InStr(1, strHTML, "badpassword") Then
        Label1.Caption = " Invalid Password/Username "
    ElseIf InStr(1, strHTML, "this account has been ") Then
        Label1.Caption = " this account has been frozen "
    ElseIf InStr(1, strHTML, "petcentral") Then
        Label1.Caption = " Successful Login "
    Else
        Label1.Caption = " unknown error "
        Exit Sub
    End If
    End Sub
    Last edited by Soredavide; 01-15-2012 at 07:02 AM.

  3. #3
    w_is_awesome's Avatar
    Join Date
    Dec 2011
    Posts
    131
    Userbars
    1
    Thanks
    61
    Thanked 11 Times in 10 Posts
    Downloads
    78
    Uploads
    0
    Mentioned
    12 Post(s)
    Time Online
    20 h 24 m
    Avg. Time Online
    N/A
    Rep Power
    10
    I use Gluarks @[Only registered and activated users can see links. ]

    edit: still says it
    Last edited by w_is_awesome; 01-15-2012 at 07:10 AM.
    [Only registered and activated users can see links. ]

  4. #4

    Join Date
    Dec 2011
    Posts
    151
    Userbars
    2
    Thanks
    4
    Thanked 165 Times in 45 Posts
    Downloads
    14
    Uploads
    9
    Mentioned
    68 Post(s)
    Time Online
    6 d 17 h 26 m
    Avg. Time Online
    2 m
    Rep Power
    11
    Strange it works for me, I get the label to change to Successful Login. Did you use the code I posted or change yours?
    Last edited by Soredavide; 01-15-2012 at 07:30 AM.

  5. #5
    w_is_awesome's Avatar
    Join Date
    Dec 2011
    Posts
    131
    Userbars
    1
    Thanks
    61
    Thanked 11 Times in 10 Posts
    Downloads
    78
    Uploads
    0
    Mentioned
    12 Post(s)
    Time Online
    20 h 24 m
    Avg. Time Online
    N/A
    Rep Power
    10
    no but now i tryed and it came up with a debug error. on the code it shows a arrow pointing toward

    "strHTML = Wrapper.PostWrapper("http://www.neopets.com/login.phtml", "username=" & txtuser.Text & "&password=" & txtpass.Text & "&destination=%2petcentral.phtml/")'

    @[Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]

  6. #6

    Join Date
    Dec 2011
    Posts
    151
    Userbars
    2
    Thanks
    4
    Thanked 165 Times in 45 Posts
    Downloads
    14
    Uploads
    9
    Mentioned
    68 Post(s)
    Time Online
    6 d 17 h 26 m
    Avg. Time Online
    2 m
    Rep Power
    11
    I am not sure if you had the quotes around the statement or that is how you posted to this site? Make sure everything is named the way it is supposed to be, the wrapper is actually named wrapper (you should get an autocomplete if it is correct, with quite a few options for a drop down)

    You can use the CODE tags to post code.
    Code:
    strHTML = Wrapper.PostWrapper("http://www.neopets.com/login.phtml", "username=" & txtuser.Text & "&password=" & txtpass.Text & "&destination=%2petcentral.phtml/")

  7. #7
    w_is_awesome's Avatar
    Join Date
    Dec 2011
    Posts
    131
    Userbars
    1
    Thanks
    61
    Thanked 11 Times in 10 Posts
    Downloads
    78
    Uploads
    0
    Mentioned
    12 Post(s)
    Time Online
    20 h 24 m
    Avg. Time Online
    N/A
    Rep Power
    10
    quotes where for website...

    ---------- Post added at 08:12 AM ---------- Previous post was at 06:55 AM ----------

    Please close I figured it out from the help of soredivide
    [Only registered and activated users can see links. ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •