Microsoft Visual Basic 2005 Step by Step (Step by Step (Microsoft))
The Anatomy of a Visual Basic Program Statement
As you learned in Chapter 2, “Writing Your First Program,” a line of code in a Visual Basic program is called a program statement. A program statement is any combination of Visual Basic keywords, properties, object names, variables, numbers, special symbols, and other values that collectively create a valid instruction recognized by the Visual Basic compiler. A complete program statement can be a simple keyword, such as
End
which halts the execution of a Visual Basic program, or it can be a combination of elements, such as the following statement, which uses the TimeString property to assign the current system time to the Text property of the Label1 object:
Label1.Text = TimeString
The rules of construction that must be used when you build a programming statement are called statement syntax. Visual Basic shares many of its syntax rules with earlier versions of the BASIC programming language and with other language compilers. The trick to writing good program statements is learning the syntax of the most useful language elements and then using those elements correctly to process the data in your program. Fortunately, Visual Basic does a lot of the toughest work for you, so the time you spend writing program code is relatively short, and the results can be reused in future programs.
In the following chapters, you'll learn the most important Visual Basic keywords and program statements, as well as many of the objects, properties, and methods provided by Visual Studio controls and the .NET Framework. You'll find that these keywords and objects complement nicely the programming skills you've already learned and will help you write powerful programs in the future. The first topics, variables and data types, are critical features of nearly every program.