I am working on this web developer page for my vb class and i can't seem to get my values to display. Can someone tell me why my values are not displaying? Here is the code that i have so far:
'Programmer: Cassie Sanford
'Date: October 12, 2008
'Description: A website to calculate the extended price for books sold,
' a discount, and the discounted amount. Calculates and displays
' the total discounts. Uses validator controls for input validation.
Partial Class _Default
Inherits System.Web.UI.Page
Private discountTotalDecimal As Decimal
Const DISCOUNT_RATE_Decimal As Decimal = 0.15D
Protected Sub submitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submitButton.Click
Dim quantityInteger As Integer
Dim priceDecimal, extendedPriceDecimal As Decimal
Dim discountDecimal, discountedPriceDecimal As Decimal
With Me
.errorMessageLabel.Text = String.Empty
Try
'Convert input values to numeric variables.
quantityInteger = Integer.Parse(.quantityTextBox.Text)
priceDecimal = Decimal.Parse(.priceTextBox.Text)
'Calculate values for sale.
extendedPriceDecimal = quantityInteger * priceDecimal
discountDecimal = extendedPriceDecimal * DISCOUNT_RATE_Decimal
discountedPriceDecimal = extendedPriceDecimal - discountDecimal
'Add to the discount total.
discountTotalDecimal += discountDecimal
'Save the discount total in a hidden field.
.discountTotalHiddenField.Value = discountTotalDecimal.ToString()
'Format and display the answers.
.extendedPriceTextBox.Text = extendedPriceDecimal.ToString("C")
.discountTextBox.Text = discountDecimal.ToString("N")
.discountedPriceTextBox.Text = discountedPriceDecimal.ToString("C")
Catch ex As Exception
.errorMessageLabel.Text = "Unable to calculate. Check for numeric values."
End Try
End With
End Sub
Protected Sub clearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearButton.Click
'Clear previous amounts from the page.
With Me
.quantityTextBox.Text = ""
.titleTextBox.Text = ""
.priceTextBox.Text = ""
.extendedPriceTextBox.Text = ""
.discountTextBox.Text = ""
.discountedPriceTextBox.Text = ""
.discountTotalLabel.Text = ""
.errorMessageLabel.Text = ""
End With
End Sub
Protected Sub summaryButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles summaryButton.Click
'Display the total discount.
Me.discountTotalLabel.Text = "Total Discounts: $" & Me.discountTotalHiddenField.Value
End Sub
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'If a value exists for the discount total...
With Me.discountTotalHiddenField
If IsPostBack And .Value <> "" Then
discountTotalDecimal = Decimal.Parse(.Value)
End If
End With
End Sub
End Class
I use a 12X3 table in the default.aspx application and a 4X2 in the contacts section....help is urgently needed!!!