Chapter 7. Controlling the Flow of Your Program

function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); } function Print() { window.focus(); if(window.print) { window.print(); window.setTimeout('window.close();',5000); } }
Team-Fly    

Special Edition Using Microsoft® Visual Basic® .NET
By Brian Siler, Jeff Spotts
Table of Contents
Part II:  Visual Basic Programming Fundamentals


In this chapter

Understanding If Statements

Using Select Case

Structuring Your Code Logically

Working with Loops

Exercise: The Pop-Up Eliminator

From Here . . .

Two of the fundamental strengths of computers are their capabilities to execute instructions quickly and to make decisions precisely. In this chapter, you will learn how to take advantage of these capabilities in two very important ways: through the use of decision-making techniques and the use of loops, which allow portions of code to run a controlled number of times.

In the last chapter, you learned about a class of code statements known as assignment statements, which are used to set and modify the values of variables. Another group of statements is important for handling more complex tasks. These statements are known collectively as control statements. Without control statements, your program would start at the first line of code and proceed line by line until the last line was reached, at which point the program would stop.

One type of control statement is the decision statement.This statement is used to control the execution of parts of your program, based on conditions that exist at the time the statement is encountered. The two basic types of decision statements are If statements and Select Case statements. The other major type of control statement is the loop. You use loops to perform repetitive tasks in your program. Three main types of loops are supported by Visual Basic: counter loops, conditional loops, and enumerator loops.


    Team-Fly    
    Top
     



    Special Edition Using Visual Basic. NET
    Special Edition Using Visual Basic.NET
    ISBN: 078972572X
    EAN: 2147483647
    Year: 2001
    Pages: 198

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net