Friday, November 14, 2008

Basic Techniques Of VB Part One

The Naming Of The Leading Variable

Consistency is often associated with the writing program code that standard. This is quite baseless because the writing code that makes the program more consistent, easy to read and understand.
For example, in the naming of variables, it is recommended that you refer to the standards that have been set. For example, such as the following:

'If there is only one string in a variable scope

Dim str As String
'If there are more than one
Dim strNama as String
Dim strAlamat As String

Avoid Data Type Variants
Data type variants will automatically be set at a variable when you do not specify the type of the data explicitly.

'Variable intX with type variants
Dim intX, intY As Integer
'Type Integer for intA and intB
Dim As intA Integer, intB As Integer

The main reasons to avoid the data type variants is due to the execution time. It will make program run slow and consume more memory.

Scope Of Variables
When the variables you only needed by a method (procedure / function), should declare at the local level. This technique is closely related to the performance of the application, where the local variables will be executed faster than global variables.

0 comments: