Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Upgrade Recommendation: Use Constants Instead of Underlying Values 

When writing code, try to use constants rather than relying on their underlying values. For example, if you are maximizing a form at run time, use:

' GOOD: Constant name
Me.WindowState = vbMaximized

rather than:

'BAD: Underlying value
Me.WindowStyle = 2
'BAD: Variable
Me.WindowStyle = X

Likewise, use True and False instead of -1 and 0.

In Visual Basic 2005, the values and in some cases the names of some properties and constants have changed. When your project is upgraded to Visual Basic 2005, most constants are changed automatically for you; however, if you use underlying values or variables instead of the constant names, many cases cannot be upgraded automatically. Using constant names minimizes the number of modifications you have to do.

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft