Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

3.2 Control Structures

Normally, statements in a program are executed one after another in the order in which they are written. This process is called sequential execution. However, various Visual Basic statements enable the programmer to specify that the next statement to be executed might not be the next one in sequence. A transfer of control occurs when a statement other than the next one in the program executes.

Visual Basic provides seven types of repetition structures: While, DoWhile/Loop,

Do/LoopWhile, DoUntil/Loop, Do/LoopUntil, For/Next and ForEach/Next. (ForEach/Next is covered in Chapter 4, Procedures and Arrays.) The words If, Then, Else, End, Select, Case, While, Do, Until, Loop, For, Next and Each are all Visual Basic keywords. (See Fig. 3.1 for a list of all the Visual Basic keywords.) We discuss many of Visual Basic's keywords and their respective purposes throughout this book.

Figure 3.1Fig. 3.1 Keywords in Visual Basic.

  • + Share This
  • 🔖 Save To Your Account