Help. I can not figure out what I have done in the following code.? I have written this and everything is working fine except I am getting only zeros on the calculations.
There are no exceptions and I am debugging in Visual Studio.
I am going to pull my hair out.
Hello all
I am new to programing and I have written the following code in Visual Studio. Everything is working fine. except nothing is calculating. all I am getting is zero’s If anyone can help I would be very grateful.
view source print?
01 |
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click |
02 |
????????’?????????? This event handler when executed checks for entry into |
03 |
????????’?????????? in the Company Name text box.? It calculates the number of |
04 |
????????’?????????? of attendees and provides a discount if the previous attended |
05 |
????????’?????????? Yes box is selected.? It displays the Total Cost of Registration. |
07 |
????????Dim decReturningCompany As Decimal = 0.15D |
08 |
????????Dim decOne As Decimal = 695D |
09 |
????????Dim decTwoFour As Decimal = 545D |
10 |
????????Dim decFiveEight As Decimal = 480D |
11 |
????????Dim deceightOrMore As Decimal = 385D |
12 |
????????Dim decTotalAttending As Decimal |
13 |
????????Dim decTotalCost As Decimal |
14 |
????????Dim decCostPerAttendee As Decimal |
15 |
????????Dim DecDiscount As Decimal |
17 |
????????’?????????? Did User enter data in Company Name? |
18 |
????????If txtCompanyName.Text = “” Then MsgBox(“Please Provide Company Name”) |
20 |
????????’?????????? Did user enter a numeric value? |
21 |
????????If IsNumeric(txtTotalActualAttending.Text) Then |
22 |
????????????decTotalAttending = Convert.ToDecimal(txtTotalActualAttending.Text) |
24 |
????????????’?????? Is number of tickets greather than zero? |
25 |
????????????If decTotalAttending > 0 Then |
27 |
????????????????’?? Calculate and display number of attendees and discount if? |
28 |
????????????????’?? previously attended. |
30 |
????????????????If radOne.Checked Then |
31 |
????????????????????decOne = decCostPerAttendee |
32 |
????????????????ElseIf radTwoToFour.Checked Then |
33 |
????????????????????decTwoFour = decCostPerAttendee |
34 |
????????????????ElseIf radFiveToEight.Checked Then |
35 |
????????????????????decFiveEight = decCostPerAttendee |
36 |
????????????????ElseIf radEightOrMore.Checked Then |
37 |
????????????????????deceightOrMore = decCostPerAttendee |
38 |
????????????????ElseIf chbReturningCompany.Checked Then |
39 |
????????????????????decReturningCompany = DecDiscount |
40 |
????????????????End If |
42 |
????????????????decTotalCost = (decTotalAttending * decCostPerAttendee) * (1 – DecDiscount) |
43 |
????????????????lblTotalCost.Text = decTotalCost.ToString(“C”) |
46 |
????????????????’?? Display error message if user entered a negative number |
47 |
????????????????MsgBox(“You Entered ” & decTotalAttending.ToString() & “. Please Enter a Positive Number of Reservations”) |
51 |
????????????’?????? Display error message if user entered a nonnumeric value |
52 |
????????????MsgBox(“Please Enter The Number of Reservations”) |
53 |
????????????txtTotalActualAttending.Text = “” |
54 |
????????????txtTotalActualAttending.Focus() |
57 |
????????btnSubmit.Visible = True |
58 |
????????lblSubmitMessage.Visible = True |
I need to calculate the number in the txtTotalActualAttending.text box by the selected radio button which has 4 possibilities.
Then I need to give a discount if the chbReturningCompany is selected.
This will be give me a total cost to be displayed in the lblTotalCost.Text (all I am getting now is $0.00.
I am sure it is something simple, but I have been trying for going on 2 days and I am at my wits end. Please and thank you
classhelp24@gmail.com [email if you need fresh paper done]