Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Hidden Variant variables

Total Hit ( 2313)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Variants are the default type of variables that are declared without an As clause, as in:

Click here to copy the following block
Dim name  ' this is a variant

or are not declared at all (which is only possible if the current module does not include any Option Explicit statement). If you are recycling programs written in Visual basic 1.0 or 2.0, or even QuickBasic, you might wish to include a DefSng A-Z at the very beginning of your modules, to make Single the default type as it was in those versions of the language. But the best approach is by far is using an explicit As clause for each declared variable.
A special case of this rule of thumb occurs when declaring more variables in the same line. Many developers, especially those that have programmed in C previously, are convinced that this line creates two Integer variables:

Click here to copy the following block
Dim x, y As Integer

while it actually makes x a variant variable. Since variant variables are generally much slower than Integer ones, you are going to have a performance hit if you do not pay enough attention to these details.


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.