Preface |
|
xii | |
|
Chapter 1 An Introduction to Visual Studio 2019/2022 and Visual Basic |
|
|
1 | (47) |
|
Focus on the Concepts Lesson |
|
|
2 | (1) |
|
F1.1 Computer Programming Terminology |
|
|
2 | (1) |
|
F1.2 The Programmer's Job |
|
|
3 | (1) |
|
F1.3 The Visual Basic Programming Language |
|
|
3 | (2) |
|
F1.4 The Visual Studio IDE |
|
|
5 | (2) |
|
F1.5 Assigning Names to Objects |
|
|
7 | (1) |
|
Apply the Concepts Lesson |
|
|
8 | (1) |
|
A1.1 Start and Configure Visual Studio Community |
|
|
8 | (3) |
|
A1.2 Create a Windows Forms Application |
|
|
11 | (3) |
|
A1.3 Manage the Windows in the IDE |
|
|
14 | (1) |
|
A1.4 Change a Form File's Name |
|
|
15 | (1) |
|
A1.5 Change the Properties of a Form |
|
|
16 | (3) |
|
|
18 | (1) |
|
|
18 | (1) |
|
The MaximizeBox, StartPosition, and Text Properties |
|
|
18 | (1) |
|
|
19 | (1) |
|
A1.7 Close and Open a Solution |
|
|
19 | (2) |
|
A1.8 Add a Control to a Form |
|
|
21 | (4) |
|
|
25 | (1) |
|
A1.10 Lock the Controls on the Form |
|
|
26 | (1) |
|
A1.11 Start and End an Application |
|
|
27 | (2) |
|
A1.12 Enter Code and Comments in the Code Editor Window |
|
|
29 | (5) |
|
The Me.close () Statement |
|
|
31 | (1) |
|
Assignment Statements and Comments |
|
|
32 | (2) |
|
A1.13 Print an Application's Code and Interface |
|
|
34 | (1) |
|
A1.14 Exit Visual Studio and Run an Executable File |
|
|
35 | (1) |
|
|
35 | (3) |
|
|
38 | (1) |
|
|
39 | (2) |
|
|
41 | (7) |
|
Chapter 2 Planning Applications and Designing Interfaces |
|
|
48 | (22) |
|
Focus on the Concepts Lesson |
|
|
49 | (1) |
|
F2.1 Planning a Windows Forms Application |
|
|
49 | (1) |
|
F2.2 Windows Standards for Interfaces |
|
|
50 | (2) |
|
Guidelines for Identifying Labels and Buttons |
|
|
51 | (1) |
|
Guidelines for Including Graphics |
|
|
51 | (1) |
|
Guidelines for Selecting Fonts |
|
|
52 | (1) |
|
Guidelines for Using Color |
|
|
52 | (1) |
|
|
52 | (1) |
|
|
53 | (3) |
|
Apply the Concepts Lesson |
|
|
56 | (1) |
|
A2.1 Create a Planning Chart for a Windows Forms Application |
|
|
56 | (1) |
|
A2.2 Design an Interface Using the Windows Standards |
|
|
57 | (1) |
|
A2.3 Add a Label Control to the Form |
|
|
58 | (1) |
|
A2.4 Add a Text Box to the Form |
|
|
59 | (1) |
|
|
60 | (2) |
|
|
62 | (2) |
|
|
64 | (1) |
|
|
64 | (2) |
|
|
66 | (4) |
|
Chapter 3 Coding with Variables, Named Constants, and Calculations |
|
|
70 | (40) |
|
Focus on the Concepts Lesson |
|
|
71 | (1) |
|
F3.1 Pseudocode and Flowcharts |
|
|
71 | (1) |
|
F3.2 The Main Memory of a Computer |
|
|
72 | (1) |
|
|
73 | (4) |
|
Selecting an Appropriate Data Type |
|
|
74 | (1) |
|
Selecting an Appropriate Name |
|
|
74 | (1) |
|
Examples of Variable Declaration Statements |
|
|
75 | (2) |
|
|
77 | (2) |
|
F3.5 Arithmetic Expressions |
|
|
79 | (2) |
|
F3.6 Assigning a Value to an Existing Variable |
|
|
81 | (2) |
|
|
83 | (1) |
|
|
84 | (2) |
|
|
86 | (3) |
|
Apply the Concepts Lesson |
|
|
89 | (1) |
|
A3.1 Determine a Memory Location's Scope and Lifetime |
|
|
89 | (1) |
|
A3.2 Use Procedure-Level Variables |
|
|
90 | (2) |
|
A3.3 Use Procedure-Level Named Constants |
|
|
92 | (1) |
|
A3.4 Use a Class-Level Variable |
|
|
93 | (2) |
|
A3.5 Use a Static Variable |
|
|
95 | (2) |
|
A3.6 Use a Class-Level Named Constant |
|
|
97 | (1) |
|
A3.7 Create a Professional-Looking Interface |
|
|
98 | (2) |
|
Code the TextChanged Event Procedure |
|
|
99 | (1) |
|
Code the Enter Event Procedure |
|
|
99 | (1) |
|
|
100 | (1) |
|
|
101 | (1) |
|
|
102 | (2) |
|
|
104 | (6) |
|
Chapter 4 The Selection Structure |
|
|
110 | (53) |
|
Focus on the Concepts Lesson |
|
|
111 | (1) |
|
F4.1 Selection Structures |
|
|
111 | (1) |
|
F4.2 The If.. Then.. Else Statement |
|
|
112 | (1) |
|
F4.3 Comparison Operators |
|
|
113 | (4) |
|
Comparison Operator Example: Total Due Application |
|
|
114 | (1) |
|
Comparison Operator Example: Net Income/Loss Application |
|
|
115 | (2) |
|
|
117 | (5) |
|
Logical Operator Example: Gross Pay Calculator Application |
|
|
120 | (2) |
|
F4.5 Summary of Operators |
|
|
122 | (2) |
|
|
124 | (3) |
|
String Comparison Example: Shipping Application |
|
|
126 | (1) |
|
F4.7 Nested Selection Structures |
|
|
127 | (4) |
|
F4.8 Multiple-Alternative Selection Structures |
|
|
131 | (2) |
|
F4.9 The Select Case Statement |
|
|
133 | (5) |
|
Specifying a Range of Values in a Case Clause |
|
|
135 | (3) |
|
Apply the Concepts Lesson |
|
|
138 | (1) |
|
A4.1 Add a Check Box to a Form |
|
|
138 | (1) |
|
A4.2 Code an Interface That Contains Check Boxes |
|
|
138 | (2) |
|
Code a Check Box's CheckedChanged Event Procedure |
|
|
140 | (1) |
|
A4.3 Add a Radio Button to a Form |
|
|
140 | (1) |
|
A4.4 Code an Interface That Contains Radio Buttons |
|
|
141 | (3) |
|
Code a Radio Button's CheckedChanged Event Procedure |
|
|
142 | (1) |
|
Use the Select Case Statement with Radio Buttons |
|
|
143 | (1) |
|
A4.5 Group Objects Using a Group Box Control |
|
|
144 | (1) |
|
A4.6 Code a Text Box's KeyPress Event Procedure |
|
|
145 | (2) |
|
A4.7 Use Arithmetic Assignment Operators |
|
|
147 | (1) |
|
|
148 | (2) |
|
|
150 | (1) |
|
|
151 | (6) |
|
|
157 | (6) |
|
Chapter 5 The Repetition Structure |
|
|
163 | (48) |
|
Focus on the Concepts Lesson |
|
|
164 | (1) |
|
F5.1 Repetition Structures |
|
|
164 | (2) |
|
F5.2 The Do...Loop Statement (Pretest Loop) |
|
|
166 | (2) |
|
F5.3 String Concatenation |
|
|
168 | (1) |
|
|
169 | (1) |
|
F5.5 The Do...Loop Statement (Posttest Loop) |
|
|
169 | (2) |
|
F5.6 Counters and Accumulators |
|
|
171 | (2) |
|
F5.7 The For.. Next Statement |
|
|
173 | (5) |
|
Comparing the For...Next and Do...Loop Statements |
|
|
176 | (1) |
|
Flowcharting a For...Next Loop |
|
|
176 | (2) |
|
Apply the Concepts Lesson |
|
|
178 | (1) |
|
A5.1 Use a Loop, a Counter, and an Accumulator |
|
|
178 | (4) |
|
A Different Version of the Projected Sales Application |
|
|
181 | (1) |
|
A5.2 Add a List Box to a Form |
|
|
182 | (4) |
|
Using the String Collection Editor to Add Items to a List Box |
|
|
183 | (1) |
|
|
184 | (1) |
|
The Selectedltem and Selectedlndex Properties |
|
|
184 | (1) |
|
The SelectedValueChanged and SelectedlndexChanged Events |
|
|
185 | (1) |
|
A5.3 Use the Methods and a Property of the Items Collection |
|
|
186 | (2) |
|
|
187 | (1) |
|
Clearing the Items from a List Box |
|
|
187 | (1) |
|
A5.4 Calculate a Periodic Payment |
|
|
188 | (4) |
|
ListBox, Loop, and Financial.Pmt Example: Monthly Payment Application |
|
|
190 | (2) |
|
A5.5 Nest Repetition Structures |
|
|
192 | (4) |
|
Nested Repetition Structure Example: Savings Account Application |
|
|
192 | (3) |
|
A Caution About Real Numbers |
|
|
195 | (1) |
|
A5.6 Designate a Default Button |
|
|
196 | (1) |
|
|
197 | (2) |
|
|
199 | (1) |
|
|
200 | (4) |
|
|
204 | (7) |
|
Chapter 6 Sub and Function Procedures |
|
|
211 | (40) |
|
Focus on the Concepts Lesson |
|
|
212 | (1) |
|
F6.1 Event-Handling Sub Procedures |
|
|
212 | (2) |
|
F6.2 Independent Sub Procedures |
|
|
214 | (4) |
|
No Parameters/Arguments Example: History Grade Application |
|
|
216 | (2) |
|
F6.3 Passing Information to a Procedure |
|
|
218 | (5) |
|
Passing Variables by Value Example: Gross Pay Application |
|
|
218 | (3) |
|
Passing Variables by Reference Example: Concert Tickets Application |
|
|
221 | (2) |
|
|
223 | (2) |
|
|
225 | (3) |
|
Apply the Concepts Lesson |
|
|
228 | (1) |
|
A6.1 Add a Combo Box to the Form |
|
|
228 | (3) |
|
A6.2 Add Items to a Combo Box and Select a Default Item |
|
|
231 | (2) |
|
A6.3 Code a Combo Box's KeyPress Event Procedure |
|
|
233 | (1) |
|
A6.4 Create an Event-Handling Sub Procedure |
|
|
233 | (1) |
|
A6.5 Invoke an Independent Sub Procedure and a Function |
|
|
234 | (1) |
|
A6.6 Create an Independent Sub Procedure |
|
|
235 | (1) |
|
|
236 | (1) |
|
A6.8 Validate an Application's Code |
|
|
236 | (1) |
|
A6.9 Use the MessageBox.Show Method |
|
|
237 | (2) |
|
A6.10 Code a Form's FormClosing Event Procedure |
|
|
239 | (2) |
|
|
241 | (1) |
|
|
242 | (1) |
|
|
243 | (3) |
|
|
246 | (5) |
|
Chapter 7 String Manipulation |
|
|
251 | (44) |
|
Focus on the Concepts Lesson |
|
|
252 | (1) |
|
|
252 | (1) |
|
The Product ID Application |
|
|
252 | (1) |
|
|
253 | (1) |
|
F7.3 The PadLeft and PadRight Methods |
|
|
254 | (2) |
|
|
255 | (1) |
|
F7.4 The Contains and Index Of Methods |
|
|
256 | (2) |
|
The City and State Application |
|
|
257 | (1) |
|
F7.5 The Substring Method |
|
|
258 | (3) |
|
The Rearrange Name Application |
|
|
259 | (2) |
|
|
261 | (2) |
|
The First Name Application |
|
|
261 | (2) |
|
|
263 | (1) |
|
F7.8 The Trim, TrimStart, and TrimEnd Methods |
|
|
263 | (3) |
|
The Tax Calculator Application |
|
|
264 | (2) |
|
|
266 | (1) |
|
|
266 | (4) |
|
The Inventory Application |
|
|
268 | (2) |
|
Apply the Concepts Lesson |
|
|
270 | (1) |
|
A7.1 Code the Check Digit Application |
|
|
270 | (3) |
|
A7.2 Code the Password Application |
|
|
273 | (3) |
|
A7.3 Generate Random Integers |
|
|
276 | (1) |
|
A7.4 Code the Guess a Letter Application |
|
|
277 | (4) |
|
Use the Enabled Property and Focus Method |
|
|
278 | (3) |
|
A7.5 Code the Guess the Word Game Application |
|
|
281 | (5) |
|
Coding the btnNewWord_Click Procedure |
|
|
281 | (2) |
|
Coding the btnTryLetter_Click Procedure |
|
|
283 | (3) |
|
|
286 | (1) |
|
|
287 | (1) |
|
|
287 | (3) |
|
|
290 | (5) |
|
|
295 | (43) |
|
Focus on the Concepts Lesson |
|
|
296 | (1) |
|
|
296 | (1) |
|
F8.2 Declaring One-Dimensional Arrays |
|
|
296 | (5) |
|
Storing Data in a One-Dimensional Array |
|
|
298 | (1) |
|
Determining the Number of Elements in a One-Dimensional Array |
|
|
299 | (1) |
|
Determining the Highest Subscript in a One-Dimensional Array |
|
|
299 | (1) |
|
Traversing a One-Dimensional Array |
|
|
300 | (1) |
|
F8.3 For Each...Next Statement |
|
|
301 | (1) |
|
F8.4 Calculating the Average Array Value |
|
|
302 | (3) |
|
F8.5 Finding the Highest Array Value |
|
|
305 | (2) |
|
F8.6 Sorting a One-Dimensional Array |
|
|
307 | (2) |
|
F8.7 Two-Dimensional Arrays |
|
|
309 | (7) |
|
Declaring a Two-Dimensional Array |
|
|
310 | (1) |
|
Storing Data in a Two-Dimensional Array |
|
|
311 | (1) |
|
Determining the Highest Subscript in a Two-Dimensional Array |
|
|
311 | (1) |
|
Traversing a Two-Dimensional Array |
|
|
312 | (2) |
|
Totaling the Values Stored in a Two-Dimensional Array |
|
|
314 | (2) |
|
Apply the Concepts Lesson |
|
|
316 | (1) |
|
A8.1 Associate an Array with a Collection |
|
|
316 | (1) |
|
A8.2 Create Accumulator and Counter Arrays |
|
|
317 | (3) |
|
A8.3 Create Parallel One-Dimensional Arrays |
|
|
320 | (2) |
|
A8.4 Search a Two-Dimensional Array |
|
|
322 | (3) |
|
|
325 | (1) |
|
|
326 | (1) |
|
|
327 | (3) |
|
|
330 | (8) |
|
Chapter 9 Sequential Access Files and Menus |
|
|
338 | (31) |
|
Focus on the Concepts Lesson |
|
|
339 | (1) |
|
F9.1 Sequential Access Files |
|
|
339 | (1) |
|
F9.2 Sequential Access Output Files |
|
|
339 | (4) |
|
Output File Example: Game Show Application |
|
|
341 | (2) |
|
F9.3 Sequential Access Input Files |
|
|
343 | (6) |
|
ReadToEnd Method Example: Game Show Application |
|
|
344 | (2) |
|
ReadLine Method Example: Game Show Application |
|
|
346 | (3) |
|
Apply the Concepts Lesson |
|
|
349 | (1) |
|
A9.1 Add a Menu to a Form |
|
|
349 | (3) |
|
|
349 | (1) |
|
Menu Example: Continents Application |
|
|
350 | (2) |
|
A9.2 Code the Items on a Menu |
|
|
352 | (2) |
|
|
354 | (2) |
|
A9.4 Accumulate the Values Stored in a File |
|
|
356 | (2) |
|
A9.5 Sort the Data Contained in a File |
|
|
358 | (2) |
|
|
360 | (1) |
|
|
360 | (1) |
|
|
361 | (1) |
|
|
362 | (7) |
|
Chapter 10 Classes and Objects |
|
|
369 | (45) |
|
Focus on the Concepts Lesson |
|
|
370 | (1) |
|
F10.1 Object-Oriented Programming |
|
|
370 | (1) |
|
|
371 | (1) |
|
F10.3 Instantiating an Object |
|
|
372 | (1) |
|
F10.4 Attributes Section of a Class |
|
|
373 | (4) |
|
Attributes Section Example: Franklin Decks Application |
|
|
375 | (2) |
|
F10.5 Behaviors Section of a Class |
|
|
377 | (7) |
|
|
377 | (1) |
|
Methods Other than Constructors |
|
|
378 | (1) |
|
Behaviors Section Example: Franklin Decks Application |
|
|
379 | (1) |
|
Using the Rectangle Class: Franklin Decks Application |
|
|
379 | (5) |
|
F10.6 Adding a Parameterized Constructor to a Class |
|
|
384 | (4) |
|
|
388 | (4) |
|
Apply the Concepts Lesson |
|
|
392 | (1) |
|
A10.1 Use a Readonly Property |
|
|
392 | (5) |
|
A10.2 Create Auto-Implemented Properties |
|
|
397 | (2) |
|
|
399 | (6) |
|
|
405 | (1) |
|
|
406 | (1) |
|
|
407 | (1) |
|
|
408 | (6) |
|
Chapter 11 SQL Server Databases |
|
|
414 | (49) |
|
Focus on the Concepts Lesson |
|
|
415 | (1) |
|
F11.1 Basic Database Terminology |
|
|
415 | (2) |
|
F11.2 Creating a SQL Server Database |
|
|
417 | (1) |
|
F11.3 Adding a Table to a Database |
|
|
418 | (3) |
|
F11.4 Adding Records to a Table |
|
|
421 | (1) |
|
F11.5 Data Source Configuration Wizard |
|
|
422 | (3) |
|
F11.6 Binding the Objects in a Dataset |
|
|
425 | (4) |
|
Having the Computer Create a Bound Control |
|
|
425 | (4) |
|
F11.7 DataGridView Control |
|
|
429 | (3) |
|
F11.8 Copy to Output Directory Property |
|
|
432 | (2) |
|
F11.9 The Try...Catch Statement |
|
|
434 | (3) |
|
F11.10 Two-Table Databases |
|
|
437 | (7) |
|
|
439 | (1) |
|
Creating a Database Query |
|
|
440 | (3) |
|
Displaying the Query Information |
|
|
443 | (1) |
|
Apply the Concepts Lesson |
|
|
444 | (1) |
|
|
444 | (3) |
|
A11.2 Bind Field Objects to Existing Controls |
|
|
447 | (2) |
|
A11.3 Perform Calculations on the Fields in a Dataset |
|
|
449 | (3) |
|
|
452 | (1) |
|
|
452 | (1) |
|
|
453 | (2) |
|
|
455 | (8) |
|
Chapter 12 Database Queries with SQL |
|
|
463 | (33) |
|
Focus on the Concepts Lesson |
|
|
464 | (1) |
|
F12.1 The SELECT Statement |
|
|
464 | (2) |
|
|
466 | (7) |
|
|
473 | (3) |
|
|
476 | (3) |
|
F12.5 Invoking a Query from Code |
|
|
479 | (3) |
|
Apply the Concepts Lesson |
|
|
482 | (1) |
|
A12.1 Add a Calculated Field to a Dataset |
|
|
482 | (3) |
|
A12.2 Use the SQL Aggregate Functions |
|
|
485 | (3) |
|
A12.3 Format the Data Stored in a Bound Control |
|
|
488 | (1) |
|
|
489 | (1) |
|
|
489 | (1) |
|
|
490 | (1) |
|
|
491 | (5) |
|
Chapter 13 Web Applications |
|
|
496 | (34) |
|
Focus on the Concepts Lesson |
|
|
497 | (1) |
|
F13.1 Basic Web Terminology |
|
|
497 | (2) |
|
F13.2 Creating a Web Application |
|
|
499 | (4) |
|
F13.3 Starting a Web Application |
|
|
503 | (1) |
|
F13.4 Modifying the Site.Master Page |
|
|
504 | (3) |
|
F13.5 Personalizing the Default.aspx Page |
|
|
507 | (1) |
|
F13.6 Personalizing the About.aspx Page |
|
|
508 | (1) |
|
F13.7 Testing with Different Browsers |
|
|
509 | (1) |
|
F13.8 Closing and Opening a Web Application |
|
|
510 | (1) |
|
Apply the Concepts Lesson |
|
|
511 | (1) |
|
A13.1 Repurposing an Existing Web Page |
|
|
511 | (2) |
|
A13.2 Adding a Table and Controls to a Web Page |
|
|
513 | (2) |
|
A13.3 Coding a Control on a Web Page |
|
|
515 | (3) |
|
A13.4 Using a Validation Control |
|
|
518 | (1) |
|
|
519 | (1) |
|
|
520 | (1) |
|
|
520 | (1) |
|
|
521 | (9) |
Appendix A GUI Design Guidelines |
|
530 | (4) |
Appendix B Additional Topics |
|
534 | (37) |
Appendix C Finding and Fixing Program Errors |
|
571 | (14) |
Appendix D Visual Basic 2019/2022 Cheat Sheet |
|
585 | (22) |
Appendix E Case Projects |
|
607 | (3) |
Index |
|
610 | |