This slide show uses option buttons, if statements and calculations.
The program was set up with text fields for name and hours and pay per hour. There is also a set of option buttons that lets the user select whether this is a Full Time employee or a Part Time employee. When the Calculate button is pressed, the Amount Earned is calculated and displayed.
Using the frame box on the tool bar, the frame is drawn. After the frame is drawn, the option buttons can be placed within the frame. This makes the frame a container to hold the option buttons. All buttons within the frame act as a single group. Note that a picture box can also be used.
In this example, the Value of OptFull has been set to True. You can see that the button has been selected. Note that if no change is made to the value, the default of False will be there and no button will be automatically selected as the default selection.
Note that the Value is False indicating that OptPart is not selected.
Full Time is a straight multiplication unless the person worked over 40 hours and then over time is calculated.
Part Time is always a straight multiplication.
The code for the Calculate button is shown on the next slide.
The code shows the Visual Basic that is run in response to a click of CmdCalc.
The properties show the name of the Command Button and the caption.
The code alone will be shown on the next slide.
Integer is a whole number.
Continued on the next slide.
This uses a simple string. Note that the IF has the Then. Note also that all IFs are closed with End If.
Note also that in this example I capitalized the Txt and Cmd in TxtAmtEarn and CmdCalc. This is not the usual convention. The usual convention will have the three characters at the beginning that denote the type in lower case. It is better to follow this convention.
The overtime calculation is 40 times the pay per hour and then the hours over are multiplied by 1.5 times the pay per hour so that you get time and one half for hours over 40.