3 list boxes, 4 buttons, 2 labels.
The application allows the user to select a workshop from lstWorkshop, Then select a location from lstLocation. Next btnAdd takes the selected workshop and location attached to a set amount of days and a registration fee and multiplies the days by a Lodging fee and outputs this number in dollar form. After multiple workshops/locations have been added btnCalc adds each of these and places them in lblTotal. The other two buttons are exit and clear which have already understand (of course the "easy" stuff)
Here is my code:
Public Class Form1 Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click 'Declare values from both listboxes Dim Day, Fee, Stay, Total As Integer 'Workshop selection Dim workshop As String = lstWorkshop.SelectedIndex() If lstWorkshop.SelectedItem = "Handling Stress" Then Day = 3 And Fee = 595 ElseIf lstWorkshop.SelectedItem = "Time Management" Then Day = 3 And Fee = 695 ElseIf lstWorkshop.SelectedItem = "Supervision Skills" Then Day = 3 And Fee = 995 ElseIf lstWorkshop.SelectedItem = "Negotiation" Then Day = 5 And Fee = 1295 ElseIf lstWorkshop.SelectedItem = "How to Interview" Then Day = 1 And Fee = 395 ElseIf lstWorkshop.SelectedItem Is Nothing Then MsgBox("Please choose a workshop first") End If 'Location selection Dim location As String = lstLocation.SelectedIndex() If lstLocation.SelectedItem = "Austin" Then Stay = Day * 95 ElseIf lstLocation.SelectedItem = "Chicago" Then Stay = Day * 125 ElseIf lstLocation.SelectedItem = "Dallas" Then Stay = Day * 110 ElseIf lstLocation.SelectedItem = "Orlando" Then Stay = Day * 100 ElseIf lstLocation.SelectedItem = "Phoenix" Then Stay = Day * 92 ElseIf lstLocation.SelectedItem = "Raleigh" Then Stay = Day * 90 ElseIf lstLocation.SelectedItem Is Nothing Then MsgBox("Please choose a location first") End If 'Total cost Total = Stay + Fee 'Display in list box lstCost.Items.Add(Total.ToString("c")) End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click lstWorkshop.SetSelected(0, False) lstLocation.SetSelected(0, False) ' clear all listboxes and Total label lstCost.Items.Clear() lblTCost.Text = "" End Sub Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() 'exit application End Sub Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click End Sub End Class
My btnAdd button will only place "$0.00 in the third listbox from there I am stuck... Please if you care to take the time and read this and help me please explain that will be the most help of all. Thank you all for your time
Workshop Selector.zip (122.91K)
Number of downloads: 1013