0

I have this :
How do i make it so when i enter 20% or a number like that into rateTextBox for it to calculate properly? Thanks

 Private Sub calcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calcButton.Click
        'Declare the variables
        Dim Sales As Decimal
        Dim commissionRate As Decimal
        Dim commission As Decimal

        'calculate the total sales
        Decimal.TryParse(saleTextBox.Text, _
                                            NumberStyles.AllowCurrencySymbol, NumberFormatInfo.CurrentInfo, Sales)
        Decimal.TryParse(rateTextBox.Text, _
                                       NumberStyles.Currency, NumberFormatInfo.CurrentInfo, commissionRate)

        commission = Sales * commissionRate

        'Display total sales

        totalLabel.Text = commission.ToString("C")

    End Sub

Edited by pritaeas: Moved to VB.NET

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by AndreRet
0

This is a vb.net question. I've asked the mods to move it over there.

Irrespective, the solution would be--

commission = (Sales * commissionRate) / 100
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.