Syntax: "Exit Sub" or "Return" in VB.NET subroutines

From the doc:

In a Sub or Set procedure, the Return statement is equivalent to an Exit Sub or Exit Property statement, and expression must not be supplied.

So they're the same in this context.

(Return (<value>) is used in functions and property.get's. Obviously slightly different in that context).


I tend to prefer Return over Exit Sub. Because once in a while you change from Sub to Function. In this case Exit Sub could be converted to Exit Function, but this assumes that there was a previous assignment to the function name (alike VB 6), which most probably didn't happen. Return would catch this situation - if the method should return a value, Return with no argument will fail at compile time.