i am using visual basic 6 for this class. if you want to use a different version, please contact...
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
I am using Visual Basic 6 for this class. If you want to use a different version, please contact me. Thanks!
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.
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.
The caption is a property of frmPay so I am changing frmPay.Caption
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:
This shows the change to the name and to the caption.
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.
I want to eliminate text1.
Now the contents or text in the box is empty.
Now I have brought over another label and named and captioned it.
Another text box has been added and named txtPayHr.I need to scroll down to text and clear out the box.
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.
Now I am bring over a command button. I need to name and caption it.
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.
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.
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
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.
I made a mistakehere - I am testingwkOvt <= 40 andI really wanted totest txtHrs. Problem!
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!!!
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!
Working with no overtime!!!
Finally working withovertime!!!!