Constants, Data Type Conversion, Visual Basic Built-in Functions

Constants are named storage locations in memory, the value of which does not change during program Execution. They remain the same throughout the program execution. When the user wants to use a value that never changes, a constant can be declared and created. The Const statement is used to create a constant. Constants can be declared in local, form, module or global scope and can be public or private as for variables. Constants can be declared as illustrated below.

Public Const gravityconstant As Single = 9.81

Predefined Visual Basic Constants
The predefined constants can be used anywhere in the code in place of the actual numeric values. This makes the code easier to read and write.   LEARN MORE >>>>>

No comments: