Question must end with a matching 'End Select'?

JimOfSacRam

New member
Joined
Jun 15, 2011
Messages
2
Programming Experience
1-3
VB.NET:
     Select Case currentNodeName
      Case "string1","string2","string3","stringEtc"
      Case Else
       For h = 0 To splitString.Length-1
        If splitString(h) = nothing
         Next For
        End If
'other code
       Next
     End Select

The above is a code snippet... of course I've already made my declarations earlier in the code. My issue is I get the error " 'Select Case' must end with a matching 'End Select'." It looks to me like VB is not liking my If statement with the "Next For" in the middle. I'm sure this is a basic syntax issue. But I'm still new to VB.net. Any help here??
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,589
Location
Norway
Programming Experience
10+
That ends the For loop, making the rest of the code invalid. It should probably be "Continue For". You could probably also reorder to "If split(h) IsNot Nothing Then 'do other code", making Continue For redundant.
For...Next Statement (Visual Basic)
 
Top Bottom