Visual Basic 語言關鍵字

更新:2007 年 11 月

下表列出全部的 Visual Basic 語言關鍵字。

保留的關鍵字

下列關鍵字是「保留的」,表示您不能使用這些關鍵字做為程式設計項目 (例如變數或程序) 的名稱。您可以將名稱包圍在括號 ([ ]) 中,以略過這項限制。如需詳細資訊,請參閱宣告項目名稱中的「逸出名稱」。

注意事項:

不建議您使用逸出名稱,因為這會使程式碼難以閱讀,並導致難以察覺的細微錯誤。

AddHandler

AddressOf

Alias

And

AndAlso

As

Boolean

ByRef

Byte

ByVal

Call

Case

Catch

CBool

CByte

CChar

CDate

CDec

CDbl

Char

CInt

Class

CLng

CObj

Const

Continue

CSByte

CShort

CSng

CStr

CType

CUInt

CULng

CUShort

Date

Decimal

Declare

Default

Delegate

Dim

DirectCast

Do

Double

Each

Else

ElseIf

End

EndIf

Enum

Erase

Error

Event

Exit

False

Finally

For

Friend

Function

Get

GetType

GetXMLNamespace

Global

GoSub

GoTo

Handles

If

If()

Implements

Imports (.NET 命名空間和型別)

Imports (XML 命名空間)

In

Inherits

Integer

Interface

Is

IsNot

Let

Lib

Like

Long

Loop

Me

Mod

Module

MustInherit

MustOverride

MyBase

MyClass

Namespace

Narrowing

New

Next

Not

Nothing

NotInheritable

NotOverridable

Object

Of

On

Operator

Option

Optional

Or

OrElse

Overloads

Overridable

Overrides

ParamArray

Partial

Private

Property

Protected

Public

RaiseEvent

ReadOnly

ReDim

REM

RemoveHandler

Resume

Return

SByte

Select

Set

Shadows

Shared

Short

Single

Static

Step

Stop

String

Structure

Sub

SyncLock

Then

Throw

To

True

Try

TryCast

TypeOf

Variant

Wend

UInteger

ULong

UShort

Using

When

While

Widening

With

WithEvents

WriteOnly

Xor

#Const

#Else

#ElseIf

#End

#If

=

&

&=

*

*=

/

/=

\

\=

^

^=

+

+=

-

-=

>> 運算子 (Visual Basic)

>>= 運算子 (Visual Basic)

<<

<<=

 

 

注意事項:

雖然在 Visual Basic 中不再使用 EndIf、GoSub、Variant 和 Wend,但仍保留做為保留的關鍵字。Let 關鍵字的意義已變更。Let 目前用於 LINQ 查詢中。如需詳細資訊,請參閱 Let 子句 (Visual Basic)

未保留的關鍵字

下列關鍵字是未保留的,表示您可以用來做為程式設計項目的名稱。不過不建議您這樣做,因為這會使程式碼難以閱讀,並導致難以察覺的細微錯誤。

Aggregate

Ansi

Assembly

Auto

Binary

Compare

Custom

Distinct

Equals

Explicit

From

Group By

Group Join

Into

IsFalse

IsTrue

Join

Key (Visual Basic)

Mid

Off

Order By

Preserve

Skip

Skip While

Strict

Take

Take While

Text

Unicode

Until

Where

#ExternalSource

#Region

 

 

 

請參閱

參考

Visual Basic 執行階段程式庫成員

關鍵字和成員 (依工作分類)

比較不同語言的關鍵字