Presentation is loading. Please wait.

Presentation is loading. Please wait.

I am using Visual Basic 6 for this class. If you want to use a different version, please contact me. Thanks!

Similar presentations


Presentation on theme: "I am using Visual Basic 6 for this class. If you want to use a different version, please contact me. Thanks!"— Presentation transcript:

1 I am using Visual Basic 6 for this class. If you want to use a different version, please contact me. Thanks!

2 These icons can be used to get the properties or tool box etc. Your setup should have the project window, the properties window, the tool box and the form. If they are missing, the icons above will make them available.

3 I changed the name property to say frmPay and the caption property to say Calculate Pay. Note that in naming things in VB, you use frm for a form, lbl for a label, txt for text boxes, cmd for command buttons etc.

4 The caption is a property of frmPay so I am changing frmPay.Caption

5 I clicked on the icon for label and brought it over and drew the label. Next, I will change the name to lblName and the caption to Name:

6 This shows the change to the name and to the caption.

7 Now I have brought over a text box and changed the name to txtName. I now need to scroll down in the property box and find the text property to take out the word Text1 from the box.

8 I want to eliminate text1.

9 Now the contents or text in the box is empty.

10 Now I have brought over another label and named and captioned it.

11 Another text box has been added and named txtPayHr. I need to scroll down to text and clear out the box.

12

13

14 Now I want to save, before I do that I am naming the project prjPay. When I save it the form with have a.frm extension and the project will have an.vbp extension. Both the form and the project need to be sent to me when you turn in an assignment.

15

16

17 Now I am bring over a command button. I need to name and caption it.

18

19 When I double click on the command button I bring up the area to write the code. Notice the sub and end sub. Notice also that this is the cmdCalc_Click() meaning when the button is clicked on this code will be executed.

20 Now I am starting to write the code. I want to change the text property in the txtPay text box to hold the result of a calculation shown on the next slide.

21 The formula is to take the text in the txtPayHr multiply by the text in the txtHrs and assign the answer to be the text in the txtPay field. txtPay.Text = txtPayHr.Text * txtHrs.Text

22

23 Now I am going to define a memory variable or work area. I will do that on the next slide with a Dim and I will name the work area wkOvt. I decided to make it an integer so I am only dealing with whole numbers.

24 I made a mistake here - I am testing wkOvt <= 40 and I really wanted to test txtHrs. Problem!

25 I am not doing tooooo well. I should have written txtHrs.Text in the IF statement and I wrote txtHours.Text which does not exist. Can't believe I did it!!!

26 It is now letting me know that there is a problem here because txtHours.Text does not exist. Would you believe I did this on purpose just to show you a mistake - NO - I don't believe it either. It was just another careless mistake!

27 Working with no overtime!!!

28 Finally working with overtime!!!!

29


Download ppt "I am using Visual Basic 6 for this class. If you want to use a different version, please contact me. Thanks!"

Similar presentations


Ads by Google