Results 1 to 27 of 27

Thread: Help with Vb program

Threaded View

  1. #14

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    12

    Re: Help with Vb program

    Code:
    Public Class SalaryCalcForm
        'Decalare module-level variables
        Private CommissionDecimal, PayDecimal, TotalPayDecimal As Decimal
        'Declare constants.
        Const COMMISSION_RATE_Decimal As Decimal = 0.15D
        Const QUOTA_Decimal As Decimal = 1000D
        Const BasePay_Decimal As Decimal = 250D
    
        Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
            'Display the About message box.
            Dim MessageString As String
            MessageString = "Salary Calculator" & Environment.NewLine & "Programmed by Andy Wong"
            MessageBox.Show(MessageString, "About Salary Calculator", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End Sub
    
        Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click
            'Allow the user to select a new font for the total pay text box.
    
            With FontDialog1
                .Font = PayTextBox.Font
                .ShowDialog()
                PayTextBox.Font = .Font
            End With
        End Sub
    
        Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorToolStripMenuItem.Click
            'Allow the user to select a new color for the text of the total pay text box
    
            With ColorDialog1
                .ShowDialog()
                PayTextBox.ForeColor = .Color
            End With
        End Sub
    
        Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click
            'Clears all data input.
    
            SaleTextBox.Clear()
            CommissionTextBox.Clear()
            PayTextBox.Clear()
            With NameTextBox
                .Clear()
                .Focus()
            End With
        End Sub
    
        Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
            'Exits the program
    
            Me.Close()
        End Sub
    
        Private Sub PayToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PayToolStripMenuItem.Click
            'Calculates and displays the commission and the total pay.
            Dim SaleDecimal, CommissionDecimal, PayDecimal, TotalPayDecimal As Decimal
            SaleDecimal = Decimal.Parse(SaleTextBox.Text)
    
            CommissionDecimal = SaleDecimal * COMMISSION_RATE_Decimal
            PayDecimal = (CommissionDecimal + BasePay_Decimal)
            TotalPayDecimal += PayDecimal
    
            CommissionTextBox.Text = CommissionDecimal.ToString("C")
            IndPayTextBox.Text = PayDecimal.ToString("C")
            PayTextBox.Text = TotalPayDecimal.ToString("C")
        End Sub
    Private Function Commission(ByVal SalesDecimal As Decimal) As Decimal
        If SalesAmountDecimal < QUOTA_Decimal Then
            Commission = OD
    Elself SalesAmountDecimal <= QUOTA_Decimal Then
            Commission(0.15 * SalesDecimal)
        Else
            Commission()
        End If
    End Function
    End Class
    notice the end class is on the last line. i get the following errors listed in the picture.
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width