I need to write a Function Procedure that will produce an amount displayed in a TaxLabel after calling it from my menu item calculate event.
Code:Private Function TaxAmount(ByVal TaxAmountDecimal As Decimal) As Decimal 'Declare variable for calculations. Dim OutputSubtotal_Decimal As Decimal 'Determine tax amount. Return 0.08D * OutputSubtotal_Decimal End FunctionCode:Dim TaxDecimal As Decimal Dim AmountDue_Decimal As Decimal Dim CarSalesPrice_Decimal As Decimal Dim Accessories_Decimal As Decimal Dim OutputSubtotal_Decimal As Decimal Dim OutputTotal_Decimal As Decimal Dim TaxAmount_Decimal As Decimal Dim TradeInAllowance_Decimal As DecimalCode:OutputSubtotal_Decimal = CarSalesPrice_Decimal + Accessories_Decimal OutputTotal_Decimal = OutputSubtotal_Decimal + TaxDecimal AmountDue_Decimal = OutputTotal_Decimal - TradeInAllowance_Decimal TaxDecimal = OutputSubtotal_Decimal + TaxAmount_DecimalI'm only getting: $0.00 in the TaxLabel? After stepping thru the program, I found the error is in the, Function statement. After following several different examples, I'm still not getting the proper tax amount displayed?Code:AmountLabel.Text = AmountDue_Decimal.ToString("c2") AccessoriesLabel.Text = Accessories_Decimal.ToString OutputSubTotalLabel.Text = OutputSubtotal_Decimal.ToString TaxLabel.Text = TaxAmount(Decimal.Parse _ (TradeInAllowanceTextBox.Text)).ToString OutputTotalLabel.Text = OutputTotal_Decimal.ToString TradeInAllowanceTextBox.Text = TradeInAllowance_Decimal.ToString




Reply With Quote