Equivalent VB keyword for 'break'

Tyronomo picture Tyronomo · Aug 8, 2008 · Viewed 121.4k times · Source

I just moved over to the Visual Basic team here at work.

What is the equivalent keyword to break in Visual Basic, that is, to exit a loop early but not the method?

Answer

John picture John · Aug 8, 2008

In both Visual Basic 6.0 and VB.NET you would use:

  • Exit For to break from For loop
  • Wend to break from While loop
  • Exit Do to break from Do loop

depending on the loop type. See Exit Statements for more details.