Declaring Variables in Visual Basic .NET and C#

Now that you have an understanding of the CLS-compliant data types in .NET, you need to learn how to use these types in your code by declaring variables. You use a declaration statement to define a variable; you also can optionally set a value for the variable when you declare it.

Note

Today, you won't create an application and follow along. You use the code in the listings throughout the day as part of your exercises at the end of the day. If you want to test the code as you're reading, you can create a Windows Forms application and add the various code listings to the code-behind for button click events.

In Visual Basic .NET, using the Dim statement is the simplest way to declare a variable. The ...

Get Sams Teach Yourself Visual Studio® .NET 2003 in 21 Days now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.