Clearly Visual Basic: Programming with Visual Basic 1-1
Chapter 1
I Am Not a Control Freak! (Control Structures)
Key Terms
Algorithm—the set of step-by-step instructions that accomplish a task Control structures—the sequence, selection, and repetition structures, which control
the flow of a program’s logic; also called logic structures
Iteration—another term for the repetition structure Logic structures—another term for control structures Loop—another term for the repetition structure Repetition structure—the control structure that directs the computer to repeat one or
more instructions until some condition is met, at which time the computer should stop
repeating the instructions; also called a loop or iteration
Selection structure—the control structure that directs the computer to make a decision and then take the appropriate action based on that decision; also called the decision
structure
Sequence structure—the control structure that directs the computer to process each instruction in the order listed in the program
Quick Quiz 1
1. A(n) __________ is a set of step-by-step instructions that accomplish a task.
2. The repetition structure is also referred to as a(n) ____________.
3. In most programs, you will use _____________ structure.
4. A cookie recipe provides a good example of the ___________ structure.
Clearly Visual Basic: Programming with Visual Basic 1-2
Clearly Visual Basic: Programming with Visual Basic 1-3
The algorithm in figure does not get a robot through the mase. Correct the algorithm.
Clearly Visual Basic: Programming with Visual Basic 1-4
Chapter 2
First You Need to Plan the Party (Problem-Solving Process)
Key Terms
Flowchart—a tool that programmers use when planning an algorithm; consists of standardized symbols
Flowlines—the lines connecting the symbols in a flowchart Input—the items an algorithm needs to achieve the output Input/output symbol—the parallelogram in a flowchart; used to represent input and
output tasks
Invalid data—data that an algorithm is not expecting the user to enter Output—the goal or purpose of solving a problem Process symbol—the rectangle in a flowchart; used to represent tasks such as
calculations
Pseudocode—a tool that programmers use when planning an algorithm; consists of short phrases
Start/stop symbol—the oval in a flowchart; used to mark the beginning and end of the flowchart
Valid data—data that an algorithm is expecting the user to enter
Quick Quiz
5. Programmers use ____________, which means false code, to help them while they are planning an algorithm.
6. A(n) ________________ uses standardized symbols to visually depict an algorithm.
Clearly Visual Basic: Programming with Visual Basic 1-5
Clearly Visual Basic: Programming with Visual Basic 1-6
Chapter 3
I Need a Tour Guide (Introduction to Visual Basic 2012)
Key Terms
Application—the combination of a program’s user interface and its code Controls—objects (such as labels and picture boxes) added to a form Font—the general shape of the characters used to display text Form—the foundation for the user interface in a Windows application; also called a
Windows form object
GUI—an acronym for graphical user interface IDE—an acronym for integrated development environment Integrated development
environment—an environment that contains all of the tools and features needed to
create, run, and test programs; also called an IDE
Label control—the control used to display text that the user is not allowed to edit while an application is running
Picture box—the control used to display an image on a form Properties—the attributes that determine an object’s appearance and behavior Properties window—the window that lists the selected object’s attributes (properties) Toolbox window—the window that contains the tools used to add controls to a form;
referred to more simply as the toolbox
User interface—what the user sees and interacts with while an application is running Windows Form Designer window—the window in which you create your
application’s GUI
Quick Quiz
7. A(n) ____ is what appears on the screen and with which you interact while using a program.
8. A(n) ____ is an environment that contains all of the tools and features you need to create, run, and test your programs.
9. A(n) ____ is the foundation for the user interface in a Windows application.
10. The objects added to a form are called ____.
11. You use a(n) ____ to display an image on the form.
12. Every object in a Visual Basic application has a set of attributes, called ____, that determine its appearance and behavior.
13. GUI stands for _______________________.
14. An _____________ control display test that the user is not allowed to edit while an application is running.
Clearly Visual Basic: Programming with Visual Basic 1-7
Chapter 4
Do It Yourself Designing (Designing Interfaces)
Key Terms
Access key—the underlined character in an object’s identifying label or caption; allows the user to select the object using the Alt key in combination with the underlined
character
Code—Visual Basic instructions Code Editor window—the window in which you enter your Visual Basic instructions
(code)
Event procedure—a set of Visual Basic instructions that tell an object how to respond to an event
Events—actions to which an object can respond; examples include clicking and double clicking
Quick Quiz
15. A(n) _________ allows the user to select a menu using the Alt key in combination with a letter or number.
16. You assign an access key by including a(n) ____ in the control’s caption or identifying label.
17. A(n) ____________ is a set of Visual Basic instructions that are processed when a specific event occurs.
Clearly Visual Basic: Programming with Visual Basic 1-8
Clearly Visual Basic: Programming with Visual Basic 1-9
Chapter 5
The Secret Code (Assignment Statements)
Key Terms
Assignment operator—the equal sign in an assignment statement to assign a value to something
Assignment statement—a statement that assigns a value to a destination (such as the property of a control)
1. Comment—a message entered in the Code Editor window for the purpose of internally documenting the code; begins with an apostrophe; also referred to as internal
documentation; to makes the code more readable and understandable
Function—a predefined procedure that performs a specific task and then returns a value after completing the task
Integer division operator—one of the arithmetic operators; represented by a backslash (\); divides two integers and then returns the quotient as an integer
Modulus operator(Mod)—represented by the keyword Mod; divides two numbers and then returns the remainder of the division
Val function—temporarily converts one or more characters to a number, and then returns the number
Quick Quiz
2. A(n) __________ is a message to the person reading the code to makes the code more readable and understandable.
3. A(n) __________ is a predefined procedure that performs a specific task and then returns a value after completing the task.
4. The __________ operator returns the remainder of the division.
5. A(n) __________ is used to assign a value to something (such as the property of a control) while an application is running.
Clearly Visual Basic: Programming with Visual Basic 1-10
8. The expression 100 /50 * 2 + 1 evaluates to __________ .
9. The expression 7 + 2 * ( 2 + 4 ) evaluates to _________ .
Clearly Visual Basic: Programming with Visual Basic 1-11
Chapter 6
Key Terms
Const statement—the statement used to declare a named constant Dim statement—the statement used to declare a procedure-level variable Formatting—specifying the number of decimal places and the special characters to
display in a number
Named constant—a computer memory location whose value cannot be changed during run time; created using the Const statement
Procedure-level variables—variables declared in a procedure; a procedure-level variable has procedure scope
String—text enclosed in double quotation marks ToString method—formats a number stored in a numeric variable and then returns the
result as text
TryParse method—converts text to a numeric data type Variables—computer memory locations where programmers can temporarily store
data, as well as change the data, while an application is running
Quick Quiz
6. Memory locations are called ____________because their contents can change (vary) as the program is running.
7. (True or False) Some variables can store a number, while others can hold text, a date, or a Boolean value.
8. (True or False) Variable names in Hungarian notation begin with a three-character ID that represents the variable’s data type.
9. To declare a variable in an event procedure, where most variables are declared, you use the Visual Basic ____________ statement.
10. A(n) ___________ is a memory location whose value cannot change while the application is running.
11. Specifying the number of decimal places and the special characters to display in a number is called ____________.
Clearly Visual Basic: Programming with Visual Basic 1-12
Clearly Visual Basic: Programming with Visual Basic 1-13
Chapter 7
Key Terms
Bug—an error in a program’s code
Debugging—the process of locating and correcting any bugs in a program
Logic error—an error that can occur for a variety of reasons, such as forgetting to enter an
instruction, entering the instructions in the wrong order, or entering a calculation statement that is
incorrect mathematically
Syntax error—an error that occurs when a statement breaks one of a programming language’s
rules
Run time error—an error that occurs when when the application is running
Quick Quiz
1. An error in a program’s code is referred to as a(n) _______.
2. The process of locating and correcting any bugs in a program is called ____________.
3. A(n) ________ occurs when you break one of the language’s rules.
Clearly Visual Basic: Programming with Visual Basic 1-14
Chapter 8
Decisions, Decisions, Decisions (Selection Structure)
Key Terms
Check boxes—controls used to offer the user one or more independent and nonexclusive choices
Comparison operators—operators used to compare values in an expression Condition—specifies the decision you are making and must be phrased so that it
evaluates to a Boolean value (either True or False)
Decision symbol—the diamond in a flowchart; used to represent the condition in selection and repetition structures
False path—contains the instructions to be processed when a selection structure’s condition evaluates to False
If…Then…Else statement—used to code the single-alternative and dual-alternative forms of the selection structure in Visual Basic
Selection structure—one of the three basic control structures; directs the computer to make a decision based on some condition and then select the appropriate action; also
called the decision structure
Statement block—in a selection structure, the set of statements in the true path and the set of statements in the false path
True path—contains the instructions to be processed when a selection structure’s condition evaluates to True
Quick Quiz
1. The ____ structure makes a decision and then takes an appropriate action based on that.
2. (True or False) All expressions containing a comparison operator will result in an answer of either True or False only.
3. (True or False) Comparison operators are evaluated after any arithmetic operators in an expression.
4. The diamond in a flowchart is called the ____ symbol.
Clearly Visual Basic: Programming with Visual Basic 1-15
8. The expression 7 + 3 * 2 > 5 * 3 evaluates to ____________.
9. The expression 6 * 4 – 3 * 2 = 18 evaluates to ____________.