PDA

Click to See Complete Forum and Search --> : VB.net 2003 - movie ticket program


chuckd
Mar 13th, 2004, 01:29 PM
OK can someone take a look at this code and tell me what you think? I have never done any programming before, save for some low level PHP...
I am taking a VB.NET class, and this is the first project we've done
I am just worried I am screwing stuff up hardcore, so maybe someone can take a look for me.


Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
Me.Close()
End Sub

Private Sub ResetButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ResetButton.Click
Me.NameTextBox.Text = ""
Me.PhoneTextBox.Text = ""
Me.AdultTextBox.Text = ""
Me.StudentTextBox.Text = ""
Me.ChildTextBox.Text = ""
Me.TotalPriceLabel.Text = "$0.00"
Me.AdultTextBox.Focus()

End Sub

Private Sub CalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CalcButton.Click
'set local constant for 6% tax rate
Const conTaxRate As Single = 0.06
'define subtotal variable
Dim sngSubTotal As Single = (Val(Me.AdultTextBox.Text) * 6) _
+ (Val(Me.StudentTextBox.Text) * 5.25) + _
(Val(Me.ChildTextBox.Text) * 3.75)
Dim sngTotalPrice As Single = sngSubTotal * (1 + conTaxRate)
Me.TotalPriceLabel.Text = sngTotalPrice
'format the Total Price Label as currency
Me.TotalPriceLabel.Text = Format(Me.TotalPriceLabel.Text, "currency")
'send focus to reset button
Me.ResetButton.Focus()

End Sub

any thoughts?

CornedBee
Mar 14th, 2004, 03:05 AM
For general code reviews I recommend you use the VB.Net forum.