We will have more books soon. Here are the pages from the book you need to complete the Chapter 6 Unit Guide.

Are you looking for the projects you need to complete at the end of the chapter? You need the Program List for Chapter 6.

Chapter 6 - Procedures

BowerPower

Sub Procedures

  1. Read pages 161-163. You've actually been using subs all along in your programming (look at the code of some of your programs). Now we will learn how to write subs that are not click events or textChanged events.
  2. You've already learned how to use a PictureBox, and this is reviewed on page 162. Here is the Greetings program shown on page 162 (you don't have to look at this).
  3. You do not need to use the word "Call" in your code. You'll see in the examples that Mr. Bower never uses that word. When this book uses the word "Call" you can leave it out from your code.
  4. Create the Friends program on page 163. Here are the images you'll need for the Friends program. On page 164 you will see underscores that work as line continuation characters. You don't need to use them with Visual Basic 2010, especially if you have word wrap turned on.

BowerPower

byVal & byRef

  1. As you read pages 165-169, don't worry if you don't understand everything. Passing values byVal and byRef will make more sense when you get to use them in programs.
  2. Modify the Guessing Game program as described on page 167. Here is the Guessing Game- Part 2 program that you can use for editing.
  3. Create the Number Breakdown program on pages 169-171.
    Don't panic when some of your code in Part C of Step 3 is underlined in blue. Until you write the code for the TwoDigits( ) and ThreeDigits( ) subs, Visual Basic won't recognize what you are trying to call in the btnBreakdown_Click event. You'll include those in Part E of Step 3, and everything will be OK!
  4. Here is the completed Sort Numbers program (shown on page 171). You can look at it to see if you understand it
  5. Download the Changing Pictures with Timer program. We will incorporate some of the code from this program into your Slot Machine program from Chapter 5! Have Mr. Bower help you learn about the Timer object and some more suggestions to make your pictures change for your program.

BowerPower

Using "sender" to Handle Multiple Events

  1. Read pages 172-173. You have already learned how one sub can handle multiple events, but it hasn't mattered which event actually triggered the sub to run because we were always going to do the same thing (clear out an answer label, for example). What if it does matter which event made things happen?
  2. Download, run, and analyze the Hot Dog program on page 173. Notice how chkSelectedTopping is declared as a CheckBox, but it doesn't appear on your form. It will equal the sender, which means it will take on all the properties of the CheckBox that got clicked.
  3. Do you see that sender appears in the parantheses at the very top of the sub? Look at some of your older programs - it's been there all along!

BowerPower

Tag

  1. In the Hot Dog II program (pages 173-174), the Tag property is utilized. Look at the design of the form, click once on a checkbox, and look at the Properties window to find the Tag property (it's always been there - we've haven't used it... until now!)
  2. Create the Shell Game program described on pages 174-177. Remember to include the values for the Tag property that are shown on page 175. Also pay attention to the Visible and Size properties. Here are the images you need for the Shell Game.
  3. You may want to use this code to generate a random number in the Shell Game.

BowerPower

Functions

  1. Read about functions on pages 177-178. Don't worry if you don't understand a lot of it. The main thing to know is that a function must return a single value.
  2. Create the Letter Grade program shown on pages 179-180. There are two functions in this program. Type each function after the "End Sub" for the btnLetterGrade_Click event.

BowerPower

Case Study - Calculator II

  1. Read about the Calculator II Case Study on pages 180-186. Here is the Calculator II program. On pages 183-184, a function is tested using the TestCalculateFunction program (looking at the TestCalculateFunction program is optional).
  2. Complete Review: Calculator II - Part 1 of 2 at the top of page 187. You will add a button for integer division (\). Remember to take care of the Tag property for the new button. You will then need to make a couple small additions to the code that already exists.

BowerPower

Sample Programs

  1. Look at the Percent Converter program written by Mr. Bower to help convert quiz and test scores (a 42-point quiz can quickly be converted to a 50-point quiz, for example). There are several subs and functions used in this program.
  2. The Sending a PictureBox to a Sub program takes a sample program from Chapter 02 and updates it for Chapter 06. Notice how byRef is used in the sub.


You're ready for the Chapter 6 Program List!

Ch 06 News

This page is ready!

Countdown to Pi Day!

Pi Day Countdown

Contact Mr. Bower

Phone:
260.356.6104 x1121

E-mail:
(combine Parts 1 and 2 with the "@" symbol)
Part 1: sbower
Part 2: hccsc.k12.in.us