introduction to programming using visual basic 6.0 cheryl klimack 729-3900...

69
Introduction to Programming Using Visual Basic 6.0 Cheryl Klimack Cheryl Klimack 729-3900 729-3900 [email protected]

Upload: piers-stevenson

Post on 29-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Introduction to Programming Using Visual Basic 6.0

Cheryl KlimackCheryl Klimack

[email protected]

Why VB? Rationale…

Easy for beginners to produce a working Easy for beginners to produce a working programprogram

Capable of high end programsCapable of high end programs GraphicalGraphical OOP (for the most part)OOP (for the most part) AffordableAffordable Many free resources availableMany free resources available

2

The VB IDEMenu bar

Tool box

Tool bar

Project Window

View Code View Object

ProjectExplorer Window

PropertiesWindow

ImmediateWindow

3

As in all Windows As in all Windows applications, simply applications, simply choose View from the choose View from the menu to view your menu to view your different toolboxes, different toolboxes, windows, etc. or to windows, etc. or to remove them from the remove them from the IDE.IDE.

View Menu

4

ObjectsEvery VB app has at Every VB app has at

least one object – the least one object – the form. form.

Other objects are added at Other objects are added at design time design time by by selecting the object from the toolbox and selecting the object from the toolbox and drawing it on the form. A second way is to drawing it on the form. A second way is to simply double-click the object and it will simply double-click the object and it will appear on the form.appear on the form.

5

Object Properties

All objects should be named. Each object has a All objects should be named. Each object has a prefix that is standard in the VB coding world. prefix that is standard in the VB coding world. For example, the prefix for a form is For example, the prefix for a form is frmfrm. See the . See the VB help for a complete list.VB help for a complete list.

Objects have many properties that can be accessed at Objects have many properties that can be accessed at design time or at run time. design time or at run time.

VB uses VB uses dot notationdot notation to access properties…for to access properties…for example: example: lblMessage.Caption = “Welcome!”lblMessage.Caption = “Welcome!”

Object Property Property Value

6

Events

An An event procedureevent procedure is a block of code that is a block of code that executes in response to an event. A executes in response to an event. A useruser event event is an action performed by the user is an action performed by the user such as a such as a mouse clickmouse click. .

7

The Inevitable Hello World Program

We will work to We will work to create the create the program shown program shown at the side.at the side.

1.1. Open VB and Open VB and choose a New, choose a New, Standard Exe Standard Exe program.program.

8

Hello World

2.2. Name the form Name the form frmHelloWorldfrmHelloWorld

3. Type in the 3. Type in the Caption as Caption as shown. Note shown. Note it change in it change in the title bar.the title bar.

9

Hello World

4.4. Save the project. Save the project. Create a new folder Create a new folder and save your form and save your form in.in.

5. A second dialog box will 5. A second dialog box will pop to ask for the Project pop to ask for the Project name…change it to name…change it to Hello Hello WorldWorld as shown to the right as shown to the right

10

6.6. Add a label Add a label object and object and resize it resize it accordingly.accordingly.

7.7. Change the Change the name to name to lblMessage.lblMessage.

8.8. Change the Change the Caption to Caption to Welcome!Welcome!

Label Object

11

9. Choose the 9. Choose the Font Font property property and make and make your font your font larger and larger and of a of a different different type.type.

Font Property

12

10. Choose the 10. Choose the Alignment Alignment property property and Center and Center the labelthe label

Alignment Property

13

11.11. Add a Add a command command button by button by double double clicking that clicking that object in the object in the toolbox. toolbox. Move it as Move it as shown.shown.

12.12. Name the Name the button button cmdDisplaycmdDisplay and change and change the caption to the caption to Display.Display.

Command Button

14

13.13. Add a button Add a button called called cmdDonecmdDone and change the and change the caption to caption to Done.Done.

Note: If you choose Note: If you choose to Copy and to Copy and Paste a control, Paste a control, you will get a you will get a message box re: message box re: Control Array. Control Array. Answer “NO” to Answer “NO” to this.this.

Done Button

15

We will begin coding We will begin coding with the with the cmdDone_Click cmdDone_Click event procedure. event procedure.

14. Double click the 14. Double click the Done button on the Done button on the object. This will object. This will open up the code open up the code editor window as editor window as shown. Type in shown. Type in Unload Me.Unload Me.

Time to Code

16

Unload Me

Adding the code Unload Me to the Adding the code Unload Me to the cmdDone_ClickcmdDone_Click event tells the computer that event tells the computer that when the control named when the control named cmdDonecmdDone is clicked, the is clicked, the form (me)form (me) will will unloadunload..

To To runrun your program, choose Run from the menu, your program, choose Run from the menu, press F5, or click the Run button on the toolbar.press F5, or click the Run button on the toolbar.

Clicking the Done button should unload your form.Clicking the Done button should unload your form.

17

Display ButtonThe code for the Display button will make the The code for the Display button will make the

Caption in the label Caption in the label lblMessagelblMessage change to change to “Hello, World”.“Hello, World”.

15. Double click the Display button and type in 15. Double click the Display button and type in the following code:the following code:

lblMessage.Caption=“Hello, lblMessage.Caption=“Hello, World”World”

Run your program and click the Run your program and click the Done button.Done button.

18

Details – Default ButtonsIt would be good if the user could simply hit the It would be good if the user could simply hit the <Enter> key to have the message change. <Enter> key to have the message change. 16. Choose the Display button, find the Default16. Choose the Display button, find the Default

property and set it to True. Run the program. Note the dark outline around the button indicating that it is Default.

19

Details – Keyboard Access Keys

Another standard Windows feature is to be Another standard Windows feature is to be able to access a key using Alt-?. To create able to access a key using Alt-?. To create this ability in your program, change the this ability in your program, change the Caption property to include an Caption property to include an &&..

Caption for Display - &Display

Caption for Done – D&one.

(You can’t have them both be a D for the hotkey.

20

Moving Your Program and Creating an exe.

Your program at this point will consist of three Your program at this point will consist of three files…files…

*.frm*.frm*.vbw*.vbw*.vbp*.vbp

You would need to transport all 3 of these to have it You would need to transport all 3 of these to have it work properly at a different location.work properly at a different location.

17. Create an exe by choosing File, Make 17. Create an exe by choosing File, Make Helloworld.exe. Choose your path. This one file, Helloworld.exe. Choose your path. This one file, of course, will allow others to run your program, of course, will allow others to run your program, but not to edit it.but not to edit it. 21

Colors

We can alter the look of your form We can alter the look of your form with colors and graphics.with colors and graphics.

18.18. Select lblMessage. Choose Select lblMessage. Choose the Backcolor property, then the Backcolor property, then Palette.Palette.

Select a color of your own choice.Select a color of your own choice.

19.19. Do the same for the Forecolor.Do the same for the Forecolor.

22

Colors on Buttons

You change the color of a button’s You change the color of a button’s background, but first you must set it’s background, but first you must set it’s Style property to Graphical.Style property to Graphical.

20.20. Choose the Display button, then change Choose the Display button, then change the Backcolor and the Style property.the Backcolor and the Style property.

Note that there is no Forecolor…the font Note that there is no Forecolor…the font stays blackstays black..

23

Graphics

We can also add graphics to some objects.We can also add graphics to some objects.

21. Select the Picture property of the Form, then choose an image. This one is at g:\klimack\images\bonnell. Change the file type to All Files if nothing is showing up.

22. Change your Done button picture property remembering to change the Style to Graphical. 24

Message Boxes23.23. In your code for the Done button, add this In your code for the Done button, add this

line:line:

MsgBox "Have a good day!", vbOKOnly, "Bye MsgBox "Have a good day!", vbOKOnly, "Bye Bye"Bye"

25

CommentsAdding comments in VB is done by prefixing your Adding comments in VB is done by prefixing your

statement with an apostrophe. For example:statement with an apostrophe. For example:‘‘this is a comment and will be ignored by the computerthis is a comment and will be ignored by the computer

Comments turn green when typed correctly.Comments turn green when typed correctly.24.24. At the top of your program, add comments with your At the top of your program, add comments with your

name, date, and project info as such:name, date, and project info as such:‘‘Cheryl KlimackCheryl Klimack‘‘Hello World projectHello World project‘‘Oct 24 2003Oct 24 2003

Run your program. We are done!Run your program. We are done!

26

Break Time!

27

Pizza Project

We will create the We will create the project shown to project shown to the left with the left with checkboxes, checkboxes, option buttons, option buttons, textboxes, textboxes, message boxes, message boxes, command buttons command buttons and labels.and labels.

28

1.1. Create a new project by first Create a new project by first removing the current project. removing the current project. Save as Pizza. Save as Pizza.

2.2. Add a label and format it as Add a label and format it as you desire.you desire.

3.3. Add an image control and Add an image control and name it name it imgPizza. imgPizza. The The image seen here is found at image seen here is found at G:\klimack\images.G:\klimack\images.

Note: to resize an image on your Note: to resize an image on your form, you must set the Stretch form, you must set the Stretch property to True.property to True.

29

4.4. Add and name Add and name labels and labels and textboxes to textboxes to correspond to the correspond to the figure at the figure at the right. Don’t right. Don’t worry about worry about lining them up lining them up perfectly yet.perfectly yet.

lblName

lblPhone

txtPhone

txtName

Choose the Text property and delete it’s contents to remove Text1 from the text boxes.

30

AligningYou can line up objects on your form evenly You can line up objects on your form evenly

by selecting them (holding down the shift by selecting them (holding down the shift key allows multiple selections) and then key allows multiple selections) and then choosing Format, Align, etc. Notice the choosing Format, Align, etc. Notice the other options under the Format menu. other options under the Format menu.

5.5. Line up your labels and text boxes.Line up your labels and text boxes.

6.6. Choose both labels and text boxes at the Choose both labels and text boxes at the same time, then select Font and make same time, then select Font and make them all 10 or 12 point.them all 10 or 12 point.

31

FramesFrames are used as containers for other Frames are used as containers for other

controls. Usually groups of option buttons controls. Usually groups of option buttons are placed in frames.are placed in frames.

7. Add a frame named fraSize.

8. Make the Caption Size.

32

Option Buttons in FrameThese are used when only one button of a group These are used when only one button of a group

should be selected. For example, a pizza size should be selected. For example, a pizza size choice cannot be both large and medium at choice cannot be both large and medium at the same time.the same time.

9. Select (but do not double click) the Option button control. Draw 3 buttons inside of the frame. Name them optSmall, optMedium, and optLarge.

10. Line them up and make the same size. Make their spacing equal as well.

33

Options on FormOptions on a form but not in a frame function as a Options on a form but not in a frame function as a

group.group.

11. Add options for Pickup and Delivery as shown. Set the Value for Pickup to True

Note: Run the program and experiment with the buttons. If you can select 2 in one group, one of them doesn’t belong. Delete it and recreate it.

34

Multiline Textboxes with Scroll Bars

12. Add a label 12. Add a label (lblAddress) for (lblAddress) for Enter Enter AddressAddress and a textbox and a textbox (txtAddress) for the (txtAddress) for the contents of the contents of the address. Make the address. Make the Multiline property Multiline property True, and set True, and set Scrollbars to Both.Scrollbars to Both.

35

CheckboxesCheckboxes allow the user to select (or Checkboxes allow the user to select (or

deselect) an option. Any number of deselect) an option. Any number of checkboxes in a group may be selected. If checkboxes in a group may be selected. If selected, it’s value is vbChecked, otherwise selected, it’s value is vbChecked, otherwise it is vbUnchecked.it is vbUnchecked.

13. Add a frame for Toppings (fraToppings).

14. Add the checkboxes indicated (chkPepperoni, etc.) 36

Order and Cancel Buttons

15. Add an Order 15. Add an Order and Cancel and Cancel button as shown button as shown in the figure at in the figure at the right. Make the right. Make the Order button the Order button Default. Add Default. Add hotkey access.hotkey access.

37

Time to Code!

The specs for this program state that the order The specs for this program state that the order can be cancelled at any time. After order can be cancelled at any time. After order placement, a message box will appear placement, a message box will appear asking the user to verify the order as asking the user to verify the order as indicated. If it is verified another message indicated. If it is verified another message box will indicate this.box will indicate this.

38

Enabling and Disabling

It is a good idea to not let the user make It is a good idea to not let the user make inappropriate choices if at all possible. inappropriate choices if at all possible.

Disable any options that are not applicable at the Disable any options that are not applicable at the current time, and enable them when current time, and enable them when appropriate.appropriate.

16. Select all the checkboxes at once and set the 16. Select all the checkboxes at once and set the Enabled property to False. Run the program.Enabled property to False. Run the program.

39

Enabling Controls

It would be appropriate for these checkboxes to be It would be appropriate for these checkboxes to be enabled after choosing a pizza size.enabled after choosing a pizza size.

17.17. Double click optSmall, and add this code to the Double click optSmall, and add this code to the procedure.procedure.

chkPepperoni.enabled=truechkPepperoni.enabled=trueRun the program. Click on Small and Run the program. Click on Small and

Pepperoni should become enabled.Pepperoni should become enabled.18. Enable each of the checkboxes in the 18. Enable each of the checkboxes in the

same manner.same manner.

40

Copy and Pasting Code

19. The code for 19. The code for Medium and Large Medium and Large will be the same as it will be the same as it is for Small, so you is for Small, so you can copy and paste it can copy and paste it into those into those procedures. Now procedures. Now choosing any of the choosing any of the sizes will enable the sizes will enable the checkboxes.checkboxes.

Choose the procedures

here.

41

The Address BoxWe don’t need the address We don’t need the address

box if the order is for box if the order is for Pickup, so it should not Pickup, so it should not be visible until the be visible until the Delivery button is Delivery button is selected.selected.

20. Choose lblAddress and 20. Choose lblAddress and txtAddress and make txtAddress and make Visible = false in the Visible = false in the properties window.properties window.

42

Delivery Option ButtonIf you choose the Delivery option, these two controls If you choose the Delivery option, these two controls ((lblAddresslblAddress and and txtAddress)txtAddress) should become visible should become visible and the cursor should move to the txtAddress box, and the cursor should move to the txtAddress box, waiting for input.waiting for input.

21. Add the following to the optDelivery_click21. Add the following to the optDelivery_clicktxtAddress.Visible = TruetxtAddress.Visible = TruelblAddress.Visible = TruelblAddress.Visible = TruetxtAddress.SetFocustxtAddress.SetFocus

43

Pickup Option Button

Just as Delivery should make the Address info Just as Delivery should make the Address info visible, Pickup should make them visible, Pickup should make them invisible.invisible.

22.22. Add the following to the optPickup_click Add the following to the optPickup_click procedure:procedure:

txtAddress.Visible = falsetxtAddress.Visible = false

lblAddress.Visible = FalselblAddress.Visible = False

44

Cancel Button

If the user clicks the If the user clicks the Cancel button, all the Cancel button, all the info currently entered info currently entered should disappear and should disappear and the form reset to the the form reset to the initial screen.initial screen.

23.23. Get to the Get to the cmdCancel_click cmdCancel_click procedure and enter procedure and enter the following lines of the following lines of code:code:

'clear the text boxes

txtName.Text = ""

txtPhone.Text = ""

txtAddress.Text = ""

45

Canceling, continued

'clear'clear the size optionsthe size options

optSmall.Value = FalseoptSmall.Value = False

optMedium.Value = optMedium.Value = FalseFalse

optLarge.Value = FalseoptLarge.Value = False

'set the pickup option'set the pickup option

optPickup.Value = TrueoptPickup.Value = True

'clear the checkboxes

chkPepperoni.Value = vbUnchecked

chkSausage.Value = vbUnchecked

chkMushrooms.Value = vbUnchecked

chkGreenPeppers.Value = vbUnchecked

chkExtraCheese.Value = vbUnchecked

chkOnions.Value = vbUnchecked

46

Canceling, continuedLast of all, disable the checkboxes again and set the focus to Last of all, disable the checkboxes again and set the focus to

txtName.txtName.

'disable the checkboxeschkPepperoni.Enabled = FalsechkSausage.Enabled = FalsechkMushrooms.Enabled = FalsechkGreenPeppers.Enabled = FalsechkExtraCheese.Enabled = FalsechkOnions.Enabled = False

‘set focustxtName.SetFocus

47

Break Time!

48

Global Variables

We are going to We are going to use some use some Global variables Global variables for this for this program. program.

24. Add the lines 24. Add the lines shown to your shown to your program. These program. These variables can be variables can be used by all the used by all the procedures. procedures.

49

ConstantsEvery time the user selects or de-selects a topping, the topping price Every time the user selects or de-selects a topping, the topping price

must change. In this case, toppings are 75 cents each. must change. In this case, toppings are 75 cents each. 25. Constants should be declared before variables, and these are 25. Constants should be declared before variables, and these are

global as well, so add them BEFORE the 2 global variables you just global as well, so add them BEFORE the 2 global variables you just added.added.

50

Topping Price

We need to ADD to the curToppings every time a new We need to ADD to the curToppings every time a new topping is selected, and SUBTRACT every time one topping is selected, and SUBTRACT every time one is de-selected.is de-selected.

26.26. In In eacheach chk procedure, add code similar to the chk procedure, add code similar to the following, changing the Pepperoni to the appropriate following, changing the Pepperoni to the appropriate topping.topping.

If chkPepperoni.value=vbChecked thenIf chkPepperoni.value=vbChecked thencurToppings=curToppings + curToppingPricecurToppings=curToppings + curToppingPrice

ElseElsecurToppings=curToppings –curToppingPricecurToppings=curToppings –curToppingPrice

End ifEnd if

51

The Immediate Window

For testing purposes, you can For testing purposes, you can ViewView the Immediate the Immediate window and see the results of the window and see the results of the debug.print debug.print itemitem statement that can be included in the code. statement that can be included in the code. Add this line to each Add this line to each chk procedurechk procedure. .

Debug.print “Toppings Debug.print “Toppings =“ ;curToppings=“ ;curToppings

When you run your program, select and de-select When you run your program, select and de-select different checkboxes and watch the results in the different checkboxes and watch the results in the immediate window.immediate window.

52

Debug.Print statements

Results of Debug.print

53

Size Price

The size price depends upon whichever option is The size price depends upon whichever option is selected. Each option procedure needs to have selected. Each option procedure needs to have code similar to the following:code similar to the following:

curSize = curSmall curSize = curSmall ‘add to ‘add to optSmalloptSmall

curSize=curMedium curSize=curMedium ‘ add to ‘ add to optMediumoptMedium

curSize=curLarge curSize=curLarge ‘add to optLarge‘add to optLarge

54

Total Price

We need to calculate the total due as an We need to calculate the total due as an addition of curSize and curToppings. addition of curSize and curToppings.

27.27. Declare curTotal as a global variable of Declare curTotal as a global variable of type currency.type currency.

Private curTotal as currencyPrivate curTotal as currency

in the General section.in the General section.

55

Calculating the TotalTo calculate curTotal, we need to add a line to every To calculate curTotal, we need to add a line to every

procedure that affects the price.procedure that affects the price.curTotal=curToppings + curSizecurTotal=curToppings + curSize28.28. Add this line to all the options for size and the Add this line to all the options for size and the

checkboxes. (Thank goodness for copy and paste!) checkboxes. (Thank goodness for copy and paste!) If you change your Debug.Print statement as shown, you If you change your Debug.Print statement as shown, you

can watch the totals as you run your program. Use can watch the totals as you run your program. Use Edit, Replace to do this.Also, copy and paste it to Edit, Replace to do this.Also, copy and paste it to your options after the lines that calculate these your options after the lines that calculate these totals.totals.

29.29. Debug.Print "Toppings ="; Debug.Print "Toppings ="; curToppings; "Total is"; curTotalcurToppings; "Total is"; curTotal

56

Verifying the Order

Now that we have the totals working properly, Now that we have the totals working properly, we need to manipulate some strings.we need to manipulate some strings.

We want a message box similar to the figure We want a message box similar to the figure to appear when the Order button is to appear when the Order button is clicked.clicked.

30.30. Declare a global variable to contain a Declare a global variable to contain a string representing the size of the Pizza.string representing the size of the Pizza.Private strSize as stringPrivate strSize as string

57

strSize

31.31. In each of the procedures for the size In each of the procedures for the size options, add a line to assign a string to options, add a line to assign a string to string size that corresponds with the size. string size that corresponds with the size.

For example, in optSmall add:For example, in optSmall add:

strSize=“Small”strSize=“Small”

In optMedium, add In optMedium, add strSize=“Medium”strSize=“Medium” & &

in optLarge add in optLarge add strSize=“Large”.strSize=“Large”.

58

Check for Required Input32.Add the 32.Add the

following following code to verify code to verify that no that no required required options or options or textboxes are textboxes are left blank. left blank. We do not We do not have time to have time to validate the validate the input today.input today.

Dim blnValidData As Boolean

'error checking

blnValidData = False

If txtName.Text = "" Then

MsgBox "Invalid name"

txtName.SetFocus

ElseIf txtPhone.Text = "" Then

MsgBox "Invalid phone"

txtPhone.SetFocus

‘to be continued59

Run your Run your project and project and click the order click the order button with button with some text some text boxes left boxes left blank.blank.

ElseIf strSize = "" Then

MsgBox "Invalid size"

optSmall.SetFocus

ElseIf optDelivery.Value = True And txtAddress = "" Then

MsgBox "Invalid address"

txtAddress.SetFocus

Else

blnValidData=True

End If60

Create a Toppings ListOnce we have validated entry in each required control, Once we have validated entry in each required control,

we can create a toppings list. Note the indenting. we can create a toppings list. Note the indenting.

33.

'list toppings in a string

If blnValidData = True Then

If chkPepperoni.Value = vbChecked Then

strToppings = strToppings & vbCrLf & "Pepperoni"

End If

If chkSausage.Value = vbChecked Then

strToppings = strToppings & vbCrLf & "Sausage"

End If

vbCrLf – carriage return, line feed

&

concatenate61

Toppings, continuedCopy and paste the if …then statement for Copy and paste the if …then statement for

Pepperoni 5 times to create appropriate if Pepperoni 5 times to create appropriate if statements for all of the toppings, as shown statements for all of the toppings, as shown for Sausage.for Sausage.

A message box can be a quick test to see if this A message box can be a quick test to see if this works:works:

MsgBox strToppings 'test toppings MsgBox strToppings 'test toppings stringstring

Delete this line once testing is completed.Delete this line once testing is completed.62

Delivery Method

The following code can be used to determine the appropriate The following code can be used to determine the appropriate string for the method of delivery:string for the method of delivery:

34. Declare a variable strDeliveryMethod as string in the 34. Declare a variable strDeliveryMethod as string in the Order procedure. Then add the following to the bottom of Order procedure. Then add the following to the bottom of the procedure.the procedure.

'check for delivery or pickup'check for delivery or pickupIf optDelivery.Value = True ThenIf optDelivery.Value = True Then strDeliveryMethod = "Delivery"strDeliveryMethod = "Delivery"ElseElse strDeliveryMethod = "Pickup"strDeliveryMethod = "Pickup"End IfEnd If

63

Message Boxes RevisitedThere are different parameters you There are different parameters you

can use with Message Boxes. can use with Message Boxes. See the Help for a complete list.See the Help for a complete list.

We are going to ask the user to We are going to ask the user to click Yes or No to confirm the click Yes or No to confirm the order. We want their response to order. We want their response to be stored so we can act upon it.be stored so we can act upon it.

If it is yes, the form should print If it is yes, the form should print and clear. If no, the message box and clear. If no, the message box should simply disappear and should simply disappear and allow the user to make the allow the user to make the required changes.required changes.

64

Message Box String

The following code will output a message box with The following code will output a message box with the appropriate strings and the Yes/No buttons.the appropriate strings and the Yes/No buttons.

35. First, declare a variable in the declaration section 35. First, declare a variable in the declaration section of the procedure.of the procedure.

Dim intOrderCorrect as Integer Dim intOrderCorrect as Integer ‘holds ‘holds yes/no response from useryes/no response from user

65

Msgbox()intOrderCorrect = MsgBox("Order for " & txtName & intOrderCorrect = MsgBox("Order for " & txtName & vbCrLf _ vbCrLf _

& strSize & "Pizza for " & strDeliveryMethod & & strSize & "Pizza for " & strDeliveryMethod & " with" _ & vbCrLf & strToppings & vbCrLf & " with" _ & vbCrLf & strToppings & vbCrLf & vbCrLf & _vbCrLf & _

"Total = " & Format(curTotal, "currency") & _"Total = " & Format(curTotal, "currency") & _

vbCrLf & vbCrLf & _vbCrLf & vbCrLf & _

"Is this order correct?", vbYesNo, "Verify "Is this order correct?", vbYesNo, "Verify Order")Order")

_

at the end of a line means that _ the code is continued _

on the next line even though _the statement is not finished.

66

vbYes, vbNo

If the order is correct, print the form and clear If the order is correct, print the form and clear it (the same as Canceling). it (the same as Canceling).

If intOrderCorrect = vbYes ThenIf intOrderCorrect = vbYes Then Me.PrintFormMe.PrintForm Call cmdCancel_ClickCall cmdCancel_ClickEnd ifEnd ifIf the order is not correct, do nothing to the If the order is not correct, do nothing to the

program.program.67

Program Complete!

68

ConclusionThank you for attending this workshop. Thank you for attending this workshop. Available on-line in zipped format is:Available on-line in zipped format is:

This presentationThis presentation Hello World program sourceHello World program source Pizza sourcePizza source Source for the simple programs included in your packageSource for the simple programs included in your package

Visit Visit www.lvp.com to order a copy of an excellent S2,S3 textbook. to order a copy of an excellent S2,S3 textbook.Visit Visit http://www.edu.gov.mb.ca/ks4/cur/cs/index.html for the new for the new

Computer Science FrameworkComputer Science Framework

69