共用方式為


#Region 指示詞

折疊並隱藏 Visual Basic 檔案中的程式代碼區段。

語法

#Region string_literal
' 0 or more statements
#End Region

組件

術語 定義
#Region 必須的。 指定區域的開頭。
string_literal 必須的。 字串 (以雙引弧括住),當區域折疊時,會做為區域的標題。 區域預設會折疊。
#End Region 必須的。 終止 區塊 #Region

備註

#Region使用指示詞來指定程式代碼區塊,以在使用Visual Studio IDE的大綱功能時展開或折疊。 您可以將其他區域或 狀區域放在其他區域內,以將類似的區域群組在一起。

範例

這個範例會使用 #Region 指示詞。

#Region "MathFunctions"
    ' Insert code for the Math functions here.
#End Region

另請參閱