This is the description for the program.
You add your hours worked(hoursworkedDecimal) and hourly pay(hourlypayDecimal). When you click calculate it multipies those two. Now if you check the checkbox "Worked Overtime?" it brings up another form. On that form you have one textbox"overtimeDecimal" with two buttons. A calculate button that should grab the hourlypayDecimal and calculate. The other button "Add to Pay" will add the pay to the first form in the "grossincomeTextBox" 'grossincomeDecimal'.
The program will calculate if I don't check the Overtime checkbox, but when I check the overtime box and click calculate, the overtime form pops up and I type in my overtime hours and click the calculate button and then I click add to pay button. Only that calculation not add to the gross pay.
I hope I did not confuse anyone. I would really really appreciate any help. I think I've already pulled out all my hair working on this.
Thank you.
Public Class grossincomeForm
Friend hoursworkedDecimal As Decimal
Friend hourlypayDecimal As Decimal
Friend grossincomeDecimal As Decimal
Private Sub calculatepayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculatepayButton.Click
Dim hoursworkedDecimal As Decimal
Dim hourlypayDecimal As Decimal
With Me
Try
hoursworkedDecimal = Decimal.Parse(.hoursworkedTextBox.Text)
hourlypayDecimal = Decimal.Parse(.hourlypayTextBox.Text)
grossincomeDecimal += (hoursworkedDecimal * hourlypayDecimal)
'Show a message box if overtime Check box is checked
If .overtimeCheckBox.Checked = True Then
overtimeForm.Show()
MessageBox.Show("Add your overtime hours", "Information")
grossincomeDecimal += overtimeForm.overtimecalc
End If
'Subtract a dollar from gross pay.
If .unitedwayCheckBox.Checked = True Then
grossincomeDecimal -= 1
End If
'Format and display values.
grossincomeTextBox.Text = grossincomeDecimal.ToString("C")
Catch quanityexception As FormatException
'Handle a price Exception
MessageBox.Show("Must enter numeric value", "Data Entry Error", _
MessageBoxButtons.OK, MessageBoxIcon.Warning)
With Me.hoursworkedTextBox
.Focus()
.SelectAll()
End With
End Try
End With
End Sub
Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click
'Clear the form
With Me
.overtimeCheckBox.Checked = False
With .hoursworkedTextBox
Me.hourlypayTextBox.Clear()
'Me.grossincomeTextBox.Clear()
.Clear()
.Focus()
End With
End With
End Sub
Here is the OvertimeForm.
Public Class overtimeForm
Friend overtimeDecimal As Decimal
Friend overtimecalc As Decimal
'Friend grossincomeDecimal As Decimal
' Friend hourlypayDecimal As Decimal
Private Sub addpayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addpayButton.Click
With Me
overtimeDecimal = Decimal.Parse(Me.overtimeTextBox.Text)
' Me.overtimecalc = grossincomeForm.grossincomeTextBox
grossincomeForm.grossincomeDecimal += overtimecalc
End With
'tell user amount was calculated to gross pay.
' MessageBox.Show("Item calculated to gross income".PadLeft(16), "Information".ToUpper, MessageBoxButtons.OK)
'close this form when info is added
Me.Close()
End Sub
Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click
Dim overtimecalc As Decimal
With Me
overtimecalc = (overtimeDecimal * grossincomeForm.hourlypayDecimal / 2)
End With
End Sub
End Class

New Topic/Question
Reply




MultiQuote





|