Chapter 5 Visual Basic Variables and Formulas, and the .NET Framework 137
Use fundamental data types in code
- On the File menu, click Open Project.
The Open Project dialog box opens.
- Open the Data Types project from the C:\Vb10sbs\Chap05\Data Types folder.
- If the project’s form isn’t visible, click Form1 .vb in Solution Explorer, and then click the
View Designer button.
Data Types is a complete Visual Basic program that I created to demonstrate how the
fundamental data types work. You’ll run the program to see what the data types look
like, and then you’ll look at how the variables are declared and used in the program
code. You’ll also learn where to place variable declarations so that they’re available
to all the event procedures in your program. - Click the Start Debugging button on the Standard toolbar.
The following application window opens:
The Data Types program lets you experiment with 11 data types, including integer,
single-precision floating point, and date. The program displays an example of each
type when you click its name in the list box.
- Click the Integer type in the list box.
The number 37500000 appears in the Sample Data box.
Note With the Short, Integer, and Long data types, you can’t insert or display commas. To
display commas, you’ll need to use the Format function.