Share via


End (Visual Basic) 

When followed by an additional keyword, terminates the definition of the statement block introduced by that keyword.

End AddHandler
End Class 
End Enum 
End Event 
End Function 
End Get 
End If 
End Interface 
End Module 
End Namespace 
End Operator 
End Property 
End RaiseEvent
End RemoveHandler
End Select 
End Set 
End Structure 
End Sub 
End SyncLock 
End Try 
End While 
End With

Parts

  • End
    Required. Terminates the definition of the programming element.
  • AddHandler
    Required to terminate an AddHandler accessor begun by a matching AddHandler statement in a custom Event Statement.
  • Function
    Required to terminate a Function procedure definition begun by a matching Function Statement (Visual Basic). If execution encounters an End Function statement, control returns to the calling code.
  • Get
    Required to terminate a Property procedure definition begun by a matching Get Statement. If execution encounters an End Get statement, control returns to the statement requesting the property's value.
  • Module
    Required to terminate a module definition begun by a matching Module Statement.
  • Namespace
    Required to terminate a namespace definition begun by a matching Namespace Statement.
  • Operator
    Required to terminate an operator definition begun by a matching Operator Statement.
  • Property
    Required to terminate a property definition begun by a matching Property Statement.
  • RaiseEvent
    Required to terminate a RaiseEvent accessor begun by a matching RaiseEvent statement in a custom Event Statement.
  • RemoveHandler
    Required to terminate a RemoveHandler accessor begun by a matching RemoveHandler statement in a custom Event Statement.
  • Set
    Required to terminate a Property procedure definition begun by a matching Set Statement (Visual Basic). If execution encounters an End Set statement, control returns to the statement setting the property's value.
  • Structure
    Required to terminate a structure definition begun by a matching Structure Statement.
  • Sub
    Required to terminate a Sub procedure definition begun by a matching Sub Statement (Visual Basic). If execution encounters an End Sub statement, control returns to the calling code.
  • SyncLock
    Required to terminate a SyncLock block definition begun by a matching SyncLock statement. See SyncLock Statement.

Remarks

The End Statement, without an additional keyword, terminates execution immediately.

When preceded by a number sign (#), the End keyword terminates a preprocessing block introduced by the corresponding directive.

  • #End
    Required. Terminates the definition of the preprocessing block.
  • #Region
    Required to terminate a source region block begun by a matching #Region Directive.

Smart Device Developer Notes

The End statement, without an additional keyword, is not supported.

See Also

Reference

End Statement