Some variables don’t change value during the execution of program. These are constants that appear many times in your code. The constants are preferred for two reasons :

 

• Constants don’t change value

• Constants are processed faster than variables

The general form to declare a constant is as follows :

Const constantname [As type] =value

The As type part of the declaration is optional. If you omit it, the constant’s type is determined by the value you assign to it. Constants also have a scope and can be Public or Private.

e.g. Public Const pi as Double =3.14159265358979

Visual Basic uses constants extensively to define the various arguments of its methods and the settings of the various control properties.



Dinesh ThakurDinesh Thakur is a Columinist and designer with strong passion and founder of Computer Notes. if you have any ideas or any request please get @me on Google+
linkedin FaceBook Twitter Google Plus