VB.NET - How to move to next item a For Each Loop?

后端 未结 6 1998
后悔当初
后悔当初 2020-12-13 22:50

Is there a statment like Exit For, except instead of exiting the loop it just moves to the next item.

For example:

For          


        
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 23:26

    When I tried Continue For it Failed, I got a compiler error. While doing this, I discovered 'Resume':

    For Each I As Item In Items
    
        If I = x Then
           'Move to next item
           Resume Next
        End If
    
        'Do something
    
    Next
    

    Note: I am using VBA here.

提交回复
热议问题