Name
Const Statement
Synopsis
[accessmodifier
] Constconstantname
[Astype
] =constantvalue
accessmodifier
optional; KeywordOne of the keywords
Public
,Private
,Protected
,Friend
, orProtected
Friend
.constantname
required; String LiteralThe name of the constant.
type
optional; KeywordThe data type; it can be
Byte
,Boolean
,Char
,Short
,Integer
,Long
,Single
,Double
,Decimal
,Date
, orString
, as well as any of the data types defined in the Base Class Library.constantvalue
required; Numeric or StringA literal, constant, or any combination of literals and constants that includes arithmetic or logical operators, except
Is
.
Description
Associates a constant value with a name. This feature is provided to make code more readable. The name is referred to as a symbolic constant.
If Option
Strict
is on, the
data type of the constant must be defined by using the
As
type
clause.
Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.