共用方式為


End <keyword> Statement (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.

  • Class
    Required to terminate a class definition begun by a matching Class Statement (Visual Basic).

  • Enum
    Required to terminate an enumeration definition begun by a matching Enum Statement (Visual Basic).

  • Event
    Required to terminate a Custom event definition begun by a matching Event Statement.

  • Function
    Required to terminate a Function procedure definition begun by a matching Function Statement (Visual Basic). If execution encounters an EndFunction 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 EndGet statement, control returns to the statement requesting the property's value.

  • If
    Required to terminate an If...Then...Else block definition begun by a matching If statement. See If...Then...Else Statement (Visual Basic).

  • Interface
    Required to terminate an interface definition begun by a matching Interface Statement (Visual Basic).

  • 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.

  • Select
    Required to terminate a Select...Case block definition begun by a matching Select statement. See Select...Case Statement (Visual Basic).

  • Set
    Required to terminate a Property procedure definition begun by a matching Set Statement (Visual Basic). If execution encounters an EndSet 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 EndSub statement, control returns to the calling code.

  • SyncLock
    Required to terminate a SyncLock block definition begun by a matching SyncLock statement. See SyncLock Statement.

  • Try
    Required to terminate a Try...Catch...Finally block definition begun by a matching Try statement. See Try...Catch...Finally Statement (Visual Basic).

  • While
    Required to terminate a While loop definition begun by a matching While statement. See While...End While Statement (Visual Basic).

  • With
    Required to terminate a With block definition begun by a matching With statement. See With...End With Statement (Visual Basic).

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.

  • #ExternalSource
    Required to terminate an external source block begun by a matching #ExternalSource Directive.

  • #If
    Required to terminate a conditional compilation block begun by a matching #If directive. See #If...Then...#Else Directives.

  • #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