I am trying to use a list for my program. It has various job roles and different pay levels, once a job role is selected (these are written in the list property, it needs to get the hourly rate from the indexdata in the propeties. This rate will then be used elsewhere.
I have tried doing it as an input, the list is called lstpaygrade and the variable is hourrate. I have this as my output
hourrate = Lstpaygrade.ListIndex
I have also tried it as .list and .listcount, I am then just trying to work out basic pay, overtime pay and output the gross pay (will be more later on). The output result though is very awkward.
The code:
Private Sub cmdcalculate_Click()
Dim hours As Single
Dim pensionselect As Boolean
Dim pensionpercentage As Integer
Dim taxablepay, tax1, tax2, hourrate, grosspay, basicpay, overtimehours, pensionamount As Currency
pensionpercentage = 5
'input
hours = txthours.Text
hourrate = Lstpaygrade.ListIndex
'process
'Works out the overtime hours
If hours > 40 Then
overtimehours = hours - 40
Else
overtimehours = 0
End If
basicpay = hours * hourrate
overtimepay = (overtimehours * hourrate) * 1.5
grosspay = basicpay + overtimepay
'output
txtgrosspay.Text = grosspay
End Sub
List: Student Mechanic Minder Tax Lawyer ItemData: 650 2500 3800 7500
For example when I select student, input 1 hour the result should be 650 but its 0. The mechanic with the same hours is 1, minder 2, tax lawyer 3. These results should be 650, 2500, 3800 and 7500.
Any help appreciated, thanks.
Oli

New Topic/Question
Reply



MultiQuote



|