Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

Q&A

  1. I don't like math, so will I not like VB programming?

    Visual Basic does all the math for you! That's why you learned the operators. People who don't like math use calculators, and people who don't like math can write VB programs.

  2. If I want to represent a person's age value, which integer-based datatype do I use?

    The quick answer is that you should use the smallest datatype that will hold every value you'd want to assign. A person's age is rarely more than 100 and doesn't ever go past 255. Therefore, you could use a Byte datatype for a person's age. The Byte datatype is small and is much more efficient than a Long. You should now have the idea that you need to ensure that your variables can hold all the data required but that you should not use one that's too large and that will use unnecessary space. Having said that, the Byte datatype is really an exception to that rule! Byte is generally reserved for special system-level coding. Generally, the smallest integer programmers use is the Integer datatype, even though an Integer datatype is slightly less efficient than a Byte datatype because the computer has to transfer more information at one time when working with integers.

Share ThisShare This

Informit Network