Hello, I just started my commission calculator VISUAL BASIC PROJECT..
And here is how far I have got,the thing is the pay and summary buttons are not working.. Thank you (IT IS URGENT)
And here is how far I have got,the thing is the pay and summary buttons are not working.. Thank you (IT IS URGENT)
Code:
Option Strict On
Option Explicit On
Public Class CommissionCalculatorForm
'Declare module-level constants.
Const BASE_PAY_Decimal As Decimal = 250D
Const QUOTA_Decimal As Decimal = 1000D
Const COMMISSION_RATE_Decimal As Decimal = 0.15D
Dim ColorDialog As Object
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
Dim QuitDialogResult As DialogResult
QuitDialogResult = MessageBox.Show("Are you sure you want to exit?", "Decsions", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
If QuitDialogResult = DialogResult.Yes Then
'Close program
Me.Close()
End If
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
MessageBox.Show("Commission Calculator by Michael" & ControlChars.NewLine & "Simple Menu and Sub-Menus" & ControlChars.NewLine & "Enjoy", "Commission Calculator, About Page", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub ChangeTextFontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChangeTextFontToolStripMenuItem.Click
With FontDialog
'Selects the current font in the dialog form
Me.ShowDialog()
'Apply the user font selection to TotalPayTextBox
TotalPayTextBox.Font = .Font
End With
End Sub
Private Sub ChangeTextColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChangeTextColorToolStripMenuItem.Click
'Changes color of information in total pay box.
With ColorDialog1
Me.ShowDialog()
CommissionTextBox.ForeColor = .Color
End With
End Sub
Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click
'Allows user to clear text within input boxes.
With NameTextBox
.Clear()
.Focus()
End With
Dim ClearDialogResult As DialogResult
ClearDialogResult = MessageBox.Show("Are you sure you want to clear the information?", "Decsions", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
NameTextBox.Clear()
WeeklyTextBox.Clear()
CommissionTextBox.Clear()
End Sub
Private Sub PayToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PayToolStripMenuItem.Click
'Calculates summary information for user.
Dim WeeklySales, CommissionTextBox As Decimal
If NameTextBox.Text = "" Then
Try
WeeklyTextBox.Text = WeeklySales.ToString("")
If WeeklySales < 1000D Then
CommissionTextBox = 0.15D * WeeklySales
Else
CommissionTextBox = 0D
End If
WeeklySales = 0.15D * CommissionTextBox
WeeklyTextBox.Text = WeeklySales.ToString("")
Catch ex As Exception
End Try
End If
MessageBox.Show("Please enter your weekly sales amount.", "Data Entry Error", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
With WeeklyTextBox
.Focus()
.SelectAll()
End With
End Sub
Private Sub SummaryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SummaryToolStripMenuItem.Click
'Displays summary for user.
Dim WeeklySales, TotalPay As Decimal
Dim MessageString As String
If WeeklySales < 1000D Then
TotalPay = 0D
ElseIf WeeklySales <= 2000 Then
TotalPay = 0.15D * WeeklySales
Else
TotalPay = 0.2D * WeeklySales
End If
CommissionTextBox.Text = TotalPay.ToString()
'Combines the message string
MessageString = "Name of Employee:" _
& NameTextBox.ToString() _
& Environment.NewLine & Environment.NewLine _
& "Total Commission:" & TotalPay.ToString("C") _
& Environment.NewLine & Environment.NewLine _
& "Weekly Sales:" & WeeklySales.ToString("C")
MessageBox.Show(MessageString, "Commission plus Weekly Sales Summary", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
End Class