Microsoft Visual Basic 2015 CHAPTER THREE Program Design and Coding Objectives ►Change the color properties of an object ►Add images to a PictureBox object ►Locate and save an image from the web ►Import an image into the Program Resources folder ►Size an image Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Objectives ►Set the Visible property in the Properties window ►Set the Enabled property in the Properties window ►Run a Visual Basic 2015 program ►Enter Visual Basic 2015 code ►Understand Visual Basic 2015 code statement formats Chapter 3: Program Design and Coding â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 3 Objectives ►Use IntelliSense to enter Visual Basic 2015 code statements ►Use code to set the Visible property of an object ►Use code to set the Enabled property of an object ►Enter comments in Visual Basic 2015 code Chapter 3: Program Design and Coding â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Objectives ►Correct errors in Visual Basic 2015 code ►Write code to use the Close() procedure ►Print code ►Prepare an event-planning document Chapter 3: Program Design and Coding â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part BackColor and ForeColor Properties ►Tap or click the Windows Form object to select it ►If necessary, scroll in the Properties window until the BackColor property is displayed, and then tap or click the right column of the BackColor property ►Tap or click the BackColor arrow Then, tap or click the Web tab to display the Web tabbed page ►Scroll to display the color you wish to apply ►Tap or click the color you wish to apply on the color list Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part BackColor Property Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Locating and Saving an Image from the Web ►Open your web browser and navigate to the webpage containing the image you want to save ►Press and hold or right-click the image, tap or click Save Picture As, and then navigate to the location on your computer where you store downloaded files ►Click the Save button to save the image Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Locating and Saving an Image from the Web Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Importing the Image into the Program Resources Folder ► With Visual Studio 2015 and the desired program open, select the desired PictureBox object by tapping or clicking it Scroll in the PictureBox Properties window until the Image property is visible Tap or click the Image property name in the left list of the Properties window ► Tap or click the ellipsis button in the right column of the Image property ► Tap or click the Import button in the Select Resource dialog box Use the features of the Open dialog box to locate the file you want to import into the program ► Select the file you want to import Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 10 Introductory Comments Chapter 3: Program Design and Coding â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 35 Correcting Errors in Code ►Using IntelliSense to help you enter code reduces the likelihood of coding errors considerably • One possible error would be to forget an apostrophe in a comment statement ►A build errors message means the Visual Basic compiler detected a coding error in the program Chapter 3: Program Design and Coding â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 36 Correcting Errors in Code Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 37 Correcting Errors in Code ►Tap or click the No button in the Microsoft Visual Studio dialog box that informs you of a build error ►Double-tap or double-click anywhere on the error line ►Tap or click in the leftmost column on the line containing the error to place the insertion point at that location ►Type an apostrophe ►Tap or click anywhere in the code window Chapter 3: Program Design and Coding â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 38 Correcting Errors in Code Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 39 Additional Tap or Click Events ►On the [Design] tabbed page, double-tap or double-click the Exit Window Button object Chapter 3: Program Design and Coding â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 40 Close Procedure ►With the insertion point positioned where you want the Close statement to appear, type clo to highlight Close in the IntelliSense list ►Press the ENTER key Chapter 3: Program Design and Coding â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 41 Printing Code ►Tap or click File on the menu bar to display the File menu ►Tap or click Print on the File menu to display the Print dialog box ►Ensure that a check mark appears in the Include line numbers check box if you want line numbers on your printout Most developers prefer line numbers on printouts ►Make any other needed selections in the Print dialog box ►Tap or click the OK button in the Print dialog box to print the code Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 42 Event-Planning Document Chapter 3: Program Design and Coding â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 43 Phase – Code the Program ►After the events and tasks within the events have been identified, the developer is ready to code the program • Entering Visual Basic statements to accomplish the tasks specified on the event-planning document ►Developer enters the code and implements the logic Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 44 Summary ►Change the color properties of an object ►Add images to a PictureBox object ►Locate and save an image from the web ►Import an image into the Program Resources folder ►Size an image Chapter 3: Program Design and Coding â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 45 Summary ►Set the Visible property in the Properties window ►Set the Enabled property in the Properties window ►Run a Visual Basic 2015 program ►Enter Visual Basic 2015 code ►Understand Visual Basic 2015 code statement formats Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 46 Summary ►Use IntelliSense to enter Visual Basic 2015 code statements ►Use code to set the Visible property of an object ►Use code to set the Enabled property of an object ►Enter comments in Visual Basic 2015 code Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 47 Summary ►Correct errors in Visual Basic 2015 code ►Write code to use the Close() procedure ►Print code ►Prepare an event-planning document Chapter 3: Program Design and Coding © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 48 Microsoft Visual Basic 2015 CHAPTER THREE COMPLETE Program Design and Coding ... property in the Properties window ►Run a Visual Basic 2015 program ►Enter Visual Basic 2015 code ►Understand Visual Basic 2015 code statement formats Chapter 3: Program Design and Coding â 2016... enter Visual Basic 2015 code statements ►Use code to set the Visible property of an object ►Use code to set the Enabled property of an object ►Enter comments in Visual Basic 2015 code Chapter. .. or in part Objectives ►Correct errors in Visual Basic 2015 code ►Write code to use the Close() procedure ►Print code ►Prepare an event-planning document Chapter 3: Program Design and Coding â 2016