Hi all new to the forum and Im needing a bit of help with my code here.
Below is my code
I have a list box with four items in it,
-Introduction to Ecommerce
-The Future of the Web
- Advanced Visual Basic
- Network Security
The first two entries need to cost $295, and the last two need to cost $395. The project has two form one being the main form (Conference Registration System) and a sub form (Conference Options), the conference options has a list box that has the above entries in it and I need to have the user check a check box to make sure they are attending the conference once that is done the user can choose an optional dinner and keynote and an options workshop. I have the initial conference fee and optional dinner and keynote checkbox correct, but the list box is where im struggling. I cant get the computations right for the list box.
If someone could point me in the right direction that would be great.
I am following a book and have read and read and read it over and over and over and am having no luck, thus is why i am here.
Thanks guys,
TECK
Below is my code
VB.NET:
Public Class frmConferenceRegistration
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Const REGISTRATION_PRICE As Integer = 895
Const OPENING_DINNER_KEYNOTE As Integer = 30
Const WORKSHOP_295 As Integer = 295
Const WORKSHOP_395 As Integer = 395
'Create an instance of the Conference Options Form
Dim frmConferenceOptions As New frmConferenceOptions
frmConferenceOptions.ShowDialog()
'Checks to see if Conference Registration is check, if not it displays an error and asks the user to select it.
If frmConferenceOptions.chkConferenceRegistration.Checked = False Then
MessageBox.Show("Please select Conference Registration when you see the Conference Options Dialog box again!", "Error!")
'Computes the total based off of the two checkboxes
'If Conference Registration is check total = 895.
'If both checkboxes are checked then the total is 925
ElseIf frmConferenceOptions.chkConferenceRegistration.Checked = True Then
lblTotalAmount.Text = REGISTRATION_PRICE.ToString("c")
If frmConferenceOptions.chkDinnerAndKeynote.Checked = True Then
If frmConferenceOptions.chkConferenceRegistration.Checked Then
lblTotalAmount.Text = (REGISTRATION_PRICE + OPENING_DINNER_KEYNOTE).ToString("c")
End If
End If
End If
'Calculates the listbox prices based on the selection that is made
If frmConferenceOptions.lstboxOptions.SelectedIndex = 0 Then
lblTotalAmount.Text = CDec(REGISTRATION_PRICE + OPENING_DINNER_KEYNOTE + WORKSHOP_295).ToString("c")
If frmConferenceOptions.lstboxOptions.SelectedIndex = 1 Then
lblTotalAmount.Text = CDec(REGISTRATION_PRICE + OPENING_DINNER_KEYNOTE + WORKSHOP_295).ToString("c")
If frmConferenceOptions.lstboxOptions.SelectedIndex = 2 Then
lblTotalAmount.Text = CDec(REGISTRATION_PRICE + OPENING_DINNER_KEYNOTE + WORKSHOP_395).ToString("c")
Else : frmConferenceOptions.lstboxOptions.SelectedIndex = 3
lblTotalAmount.Text = CDec(REGISTRATION_PRICE + OPENING_DINNER_KEYNOTE + WORKSHOP_395).ToString("c")
End If
End If
End If
End Sub
Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnReset_Click(sender As System.Object, e As System.EventArgs) Handles btnReset.Click
'Resets all labels
lblTotalAmount.Text = String.Empty
txtAddress.Clear()
txtCity.Clear()
txtCompany.Clear()
txtEmail.Clear()
txtName.Clear()
txtPhone.Clear()
txtState.Clear()
txtZip.Clear()
End Sub
End Class
I have a list box with four items in it,
-Introduction to Ecommerce
-The Future of the Web
- Advanced Visual Basic
- Network Security
The first two entries need to cost $295, and the last two need to cost $395. The project has two form one being the main form (Conference Registration System) and a sub form (Conference Options), the conference options has a list box that has the above entries in it and I need to have the user check a check box to make sure they are attending the conference once that is done the user can choose an optional dinner and keynote and an options workshop. I have the initial conference fee and optional dinner and keynote checkbox correct, but the list box is where im struggling. I cant get the computations right for the list box.
If someone could point me in the right direction that would be great.
I am following a book and have read and read and read it over and over and over and am having no luck, thus is why i am here.
Thanks guys,
TECK