Windows Develop Bookmark and Share   
 index > Windows Forms Designer > For Next Statement
 

For Next Statement

What is the proper way (in VB.NET) to exit a For Next loop and continue with the next iteration?  I don't want to abort the looping, just skip the current iteration and continue with the next one if a null is encountered in my process.
MigrationUser 1  Thursday, May 15, 2003 8:49 AM
I'm pretty sure, that unfortunately, there is no "continue" statement in VB.NET (someone please prove me wrong).

So really you'll probably just need to write an if statement to see if you should skip over the remaining lines in your loop or not.
MigrationUser 1  Thursday, May 15, 2003 11:36 AM
It's not very elegant, but you could use the GoTo statement if you absolutely need it, or put everything inside of an If...Then...Else block.
MigrationUser 1  Monday, June 23, 2003 9:49 PM

You mean like this?

For iNum As Integer = 0 to 10
    '*** assign sValue here ***
    If sValue > "" Then
        'Do something with value
    End If
Next iNum
MigrationUser 1  Thursday, July 10, 2003 3:38 PM

You can use google to search for other answers

Custom Search

More Threads

• [C++] Moving pictures inside a Form ?!
• Host Designer
• Control with fallback resources in satellite assembly can not be used with designer
• dragging controls during runtime
• Public statusstrip in base winform is not accessible in derived form?
• I cannot get designer view....
• Moving controls doesn't work after migrating to VS2005
• PropertyGrid support for NameValueCollection
• how to handle Events of user control?
• Resize form