Ok I solved that problem, here is my new code.
CODE
Option Strict On
Public Class Form1
'Declare module-level constants.
Const BONUS_PERCENT_Decimal As Decimal = 0.02D
Const FOUR_WEEK_Integer As Integer = 160
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintForm1.Click
'Calculate the bonus earned by each employee
Dim SalesDecimal, HoursDecimal, BonusDecimal As Decimal
Try
'Convert store sales if valid input
SalesDecimal = Decimal.Parse(SalesTextBox.Text)
Try
'Convert hours if valid input
HoursDecimal = Decimal.Parse(HoursTextBox.Text)
'Calculate and display the bonus
BonusDecimal = (HoursDecimal / FOUR_WEEK_Integer) * (SalesDecimal * BONUS_PERCENT_Decimal)
BonusTextBox.Text = BonusDecimal.ToString("C")
Catch HoursException As FormatException
'Handle the number of hours
MessageBox.Show("Hours must be numeric data.", "Invalid Input", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
With HoursTextBox
.Focus()
.SelectAll()
End With
End Try
Catch SalesException As FormatException
'Handle the amount of sales
MessageBox.Show("Sales must be numeric data.", "Invalid Input", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
With SalesTextBox
.Focus()
.SelectAll()
End With
Catch AnException As Exception
MessageBox.Show("Error: " & AnException.Message)
End Try
End Sub
Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
'Clear the form
HoursTextBox.Clear()
BonusTextBox.Clear()
With NameTextBox
.Clear()
.focus()
End With
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
'End the program
Me.Close()
End Sub
Private Sub PrintButton_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
'Print the form
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()
End Sub
End Class
and here are my errors:
Error 1 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. H:\Visual Studio 2008\Projects\VB Mail Order 1\jps27\jps27\Form1.vb 48 103 jps27
Error 2 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. H:\Visual Studio 2008\Projects\VB Mail Order 1\jps27\jps27\Form1.vb 59 102 jps27
Error 3 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. H:\Visual Studio 2008\Projects\VB Mail Order 1\jps27\jps27\Form1.vb 65 103 jps27
Error 4 'PrintAction' is not a member of 'System.Windows.Forms.Button'. H:\Visual Studio 2008\Projects\VB Mail Order 1\jps27\jps27\Form1.vb 68 9 jps27
Error 5 'Print' is not a member of 'System.Windows.Forms.Button'. H:\Visual Studio 2008\Projects\VB Mail Order 1\jps27\jps27\Form1.vb 69 9 jps27
Thanks for your help
This post has been edited by gdcmf: 5 Oct, 2008 - 09:00 PM