Equivalent VB keyword for 'break'


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?

This question is tagged with vb.net loops vb6 exit

~ Asked on 2008-08-08 07:11:40

3 Answers


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.

~ Answered on 2008-08-08 07:13:56


In case you're inside a Sub of Function and you want to exit it, you can use :

Exit Sub


Exit Function 

~ Answered on 2013-04-15 19:08:40


Exit [construct], and intelisense will tell you which one(s) are valid in a particular place.

~ Answered on 2008-08-08 08:37:27

Most Viewed Questions: