Jump to content

FSO


magyar

Recommended Posts

Hello,Is it possible to have If statements within While/Wend looping. For example I'm extracting info from a text file based on user inputting his email address. This info is a number and is either "1", "2" or "3". I have following code:While Not gtFile.AtEndOfStream strLine = gtFile.ReadLine If InStr(strLine, strEmail) Then gtfile.CloseDim mytxtmytxt = Split(strLine, " ")(3) 'occupies 4th position on textfile line If mytxt = "1" Then Response.Redirect ("page1.asp") Else If mytxt = "2" Then Response.Redirect ("page2.asp") Else Response.Redirect ("page3.asp") End If End IfWENDResponse.Redirect ("page4.asp")This always throws an error and refers to the word 'Wend'Any help appreciatedmagyar

Link to comment
Share on other sites

Try

While Not gtFile.AtEndOfStreamstrLine = gtFile.ReadLineIf InStr(strLine, strEmail) Then gtfile.CloseDim mytxtmytxt = Split(strLine, " ")(3) 'occupies 4th position on textfile lineIf mytxt = "1" ThenResponse.Redirect ("page1.asp")ElseIf mytxt = "2" ThenResponse.Redirect ("page2.asp")ElseResponse.Redirect ("page3.asp")End IfEnd IfWendResponse.Redirect ("page4.asp")

Link to comment
Share on other sites

Is it possible to have If statements within While/Wend looping.
Yes, you can nest any control structure inside any other control structure.
This always throws an error and refers to the word 'Wend'
Well what's the error say? It looks like you left out an end if somewhere. There are 3 if statements and 2 end if statements.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...