Hey all,
I apologize now for being a Noob. I'm using a Tutorial to learn VB6 (for starters) and everything was going great until just now... The assignment is to create a Weekly Payroll. I have managed to figure out how to make the standard calc ( Hrs worked * Rate ) and display properly, however, that's when my legs get knocked out from under me :D
I'm not entirely sure how to subtract the deductions. I tried searching but couldn't find a similar situation. Below is my working code, albeit probably OC'd... over-coded.
*scratches head... how do I subtract? I 'thought' it would be:
If opta.Value = True Then _
intgsal = (txthrs.Text * 10) _
And intnet = (txthrs.Text * 10 - txtded.Text) <-- txtded.Text being my Deductions
txtgsal.Text = intgsal
txtnet.Text = intnet
...I was sooooo wrong... more errors than a little bit! :D
My 'working' code is below - any help would be appreciated! Also, if there are shortcuts (i.e., functions) that I could use in the future - I would like to know that as well!
Thanks again!
'setting up Integers for
'calculations
Option Explicit
Dim intgsal As Integer 'Gross Salary
Dim intnet As Integer 'Net Salary
Dim inthrs As Integer 'Hours Worked
Dim intded As Integer 'Deductions
'setting text box values to
'"blank" and "0"
Private Sub Form_Load()
txtname.Text = " "
txthrs.Text = "0.00"
txtded.Text = "0.00"
txtgsal.Text = "0.00"
txtnet.Text = "0.00"
End Sub
'coding Confirm to calculate
Private Sub cmdconfirm_Click()
If opta.Value = True Then _
intgsal = (txthrs.Text * 10)
txtgsal.Text = intgsal
End Sub