PDA

View Full Version : [VB6] Compile Error: Block If without End If



w_is_awesome
01-15-2012, 04:54 AM
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.


Private Sub Command1_Click()
Dim strHTML As String

strHTML = Wrapper.PostWrapper("[Only registered and activated users can see links]", "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

Soredavide
01-15-2012, 06:55 AM
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?



Private Sub Command1_Click()
Dim strHTML As String

strHTML = Wrapper.PostWrapper("[Only registered and activated users can see links]", "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

w_is_awesome
01-15-2012, 07:07 AM
I use Gluarks Soredavide

edit: still says it

Soredavide
01-15-2012, 07:28 AM
Strange it works for me, I get the label to change to Successful Login. Did you use the code I posted or change yours?

w_is_awesome
01-15-2012, 07:35 AM
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("[Only registered and activated users can see links]", "username=" & txtuser.Text & "&password=" & txtpass.Text & "&destination=%2petcentral.phtml/")'

Soredavide

Soredavide
01-15-2012, 07:42 AM
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.


strHTML = Wrapper.PostWrapper("[Only registered and activated users can see links]", "username=" & txtuser.Text & "&password=" & txtpass.Text & "&destination=%2petcentral.phtml/")

w_is_awesome
01-15-2012, 09:12 AM
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