i am using visual basic 6 for this class. if you want to use a different version, please contact...

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

Upload: gervais-richards

Post on 20-Jan-2018

216 views

Category:

Documents


0 download

DESCRIPTION

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.

TRANSCRIPT

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

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

Page 2: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

These icons can be used to get the properties or tool box etc.

Your setup should havethe project window, theproperties window, thetool box and the form.If they are missing, theicons above will makethem available.

Page 3: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

I changed the nameproperty to say frmPayand the caption propertyto 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.

Page 4: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

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

Page 5: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

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

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

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

Page 7: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

Now I have brought over a text box and changedthe name to txtName. I now need to scroll downin the property box and find the text property totake out the word Text1 from the box.

Page 8: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

I want to eliminate text1.

Page 9: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

Now the contents or text in the box is empty.

Page 10: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

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

Page 11: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

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

Page 12: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…
Page 13: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…
Page 14: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

Now I want to save, beforeI do that I am naming theproject prjPay.When I save it theform with have a .frmextension and the project will have an.vbp extension.Both the form andthe project need to besent to me when you turn in an assignment.

Page 15: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…
Page 16: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…
Page 17: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

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

Page 18: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…
Page 19: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

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

Page 20: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

Now I am starting to write the code. I want tochange the text property in the txtPay text boxto hold the result of a calculation shown on thenext slide.

Page 21: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

The formula is to take the text in the txtPayHrmultiply by the text in the txtHrs and assign the answerto be the text in the txtPay field.

txtPay.Text = txtPayHr.Text * txtHrs.Text

Page 22: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…
Page 23: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

Now I am going to definea memory variable orwork area.I will do that on the nextslide with a Dim andI will name the work areawkOvt. I decided to make itan integer so I am only dealing with whole numbers.

Page 24: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

I made a mistakehere - I am testingwkOvt <= 40 andI really wanted totest txtHrs. Problem!

Page 25: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

I am not doingtooooo well. I shouldhave written txtHrs.Textin the IF statement andI wrote txtHours.Textwhich does not exist.Can't believe I did it!!!

Page 26: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

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 youa mistake - NO - I don't believe it either. It was just another careless mistake!

Page 27: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

Working with no overtime!!!

Page 28: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…

Finally working withovertime!!!!

Page 29: I am using Visual Basic 6 for this class. If you want to use a different version, please contact me.…