Vb.net 如何在循环内重新执行代码

Vb.net 如何在循环内重新执行代码,vb.net,Vb.net,我有一个vb.net应用程序,它使用如下循环: While Not EOF(0) If value = value2 Then ..execute code here Else 'display error MsgBox("Not Found") End If End While 这基本上是通过文件和数据库中的匹配数据进行循环。如果没有找到匹配项,则MsgBox将显示一个错误,因此当显示该错误时,我希望能够将必要的行添加到

我有一个vb.net应用程序,它使用如下循环:

While Not EOF(0)
    If value = value2 Then
        ..execute code here
    Else
        'display error
        MsgBox("Not Found")
    End If
End While

这基本上是通过文件和数据库中的匹配数据进行循环。如果没有找到匹配项,则MsgBox将显示一个错误,因此当显示该错误时,我希望能够将必要的行添加到数据库中,然后关闭消息框并重新运行代码,但不重新运行整个循环,只运行失败的循环

While Not EOF(0)
    If value = value2 Then
        ..execute code here
    Else
       'display error
       new_value = InputBox("Insert new value", "Not Found", value)
       'here your code, where you can try to update the table row with new value
   End If
End While

InputBox将暂时停止循环,并在提交后继续。

到目前为止,您还没有告诉我们您的问题,只是您没有执行所需操作的代码。