The Visual Basic 2005 IDE is a powerful RAD tool, but as you saw in Chapter 1, sooner or later you have to roll up your sleeves and write some code, whether it’s to handle a simple button event or perform a complex series of calculations on stored data. In this chapter, you’ll take a look at the syntax of the VB 2005 language itself. While VB 2005 is a member in good standing of the .NET family of languages, it retains much of the flavor of its VB 6 lineage. This chapter will get you quickly up to speed with VB 2005 language and along the way will show you how some of its features have changed from those of VB 6.
Table 2-1 lists the data types supported by VB 2005 and their counterparts in VB 6. If the size of a VB 6 type differs from that of its corresponding VB 2005 type, its size in bytes is shown in parentheses. For example, the
Currency type (which takes up 8 bytes) in VB 6 is replaced in VB 2005 by the
Decimal type. The old
Decimal type (which takes up 12 bytes in VB 6), is now 16 bytes.
Integer is now 4 bytes, instead of its 2 bytes in VB 6. Likewise, the
Long data type is now 8 bytes, instead of its 4 bytes in VB 6.
VB 6 Tip: The venerable VB 6
Variant data type in VB 6 is no longer supported in VB 2005; you should use the
Object type instead.
Object and the types that derive from it are discussed at greater length in Chapter 3.