I am working on the workshop selector in Visual Basics 7th Edition chapter 5 and I just can't get the calculate total button to work after trying numerous different codes. Here is the criteria for the program.

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 the calculate total button adds each of these and places them in lblTotal.

Here is the code that i have for Add Workshop that works fine.

Private Sub BtnAddWorkshop_Click(sender As Object, e As EventArgs) Handles BtnAddWorkshop.Click
    Dim strWorkshop As String
    Dim strLocation As String

    Dim strCost As String
    strWorkshop = CStr(lstWorkshop.Text)
    strLocation = CStr(lstLocation.Text)

    strCost = CStr(lstCost.Text)

    Dim intWorkshopCost As Integer
    Dim intNumOfDays As Integer
    Dim intRegFee As Integer
    Dim intCostPerDay As Integer
    Dim intTotal As Integer
    lstCost.Items.Add(intNumOfDays)
    lstCost.Items.Add(intRegFee)
    lstCost.Items.Add(intCostPerDay)
    lstCost.Items.Add(intTotal)

    If lstWorkshop.SelectedIndex = -1 Then
        MessageBox.Show("Select a workshop.")
    ElseIf lstLocation.SelectedIndex = -1 Then
        MessageBox.Show("Select a city.")
    End If

    If lstWorkshop.SelectedIndex = 0 Then
        intRegFee = 595
        intNumOfDays = 3
        lstCost.Items.Insert(0, "Handling Stress : $" & intRegFee)
    ElseIf lstWorkshop.SelectedIndex = 1 Then
        intRegFee = 695
        intNumOfDays = 3
        lstCost.Items.Insert(0, "Time Management : $" & intRegFee)
    ElseIf lstWorkshop.SelectedIndex = 2 Then
        intRegFee = 995
        intNumOfDays = 3
        lstCost.Items.Insert(0, "Supervision Skills : $" & intRegFee)
    ElseIf lstWorkshop.SelectedIndex = 3 Then
        intRegFee = 1295
        intNumOfDays = 5
        lstCost.Items.Insert(0, "Negotiation : $" & intRegFee)
    ElseIf lstWorkshop.SelectedIndex = 4 Then
        intRegFee = 395
        intNumOfDays = 1
        lstCost.Items.Insert(0, "How to Interview : $" & intRegFee)
    End If

    If lstLocation.SelectedIndex = 0 Then
        intCostPerDay = 95 * intNumOfDays
        lstCost.Items.Insert(0, "Austin : $" & intTotal)
    ElseIf lstLocation.SelectedIndex = 1 Then
        lstCost.Items.Insert(0, "Chicago : $" & intTotal)
    ElseIf lstLocation.SelectedIndex = 2 Then
        lstCost.Items.Insert(0, "Dallas : $" & intTotal)
    ElseIf lstLocation.SelectedIndex = 3 Then
        lstCost.Items.Insert(0, "Orlando : $" & intTotal)
    ElseIf lstLocation.SelectedIndex = 4 Then
        lstCost.Items.Insert(0, "Phoenix : $" & intTotal)
    ElseIf lstLocation.SelectedIndex = 5 Then
        lstCost.Items.Insert(0, "Raleigh : $" & intTotal)
    End If

    intWorkshopCost = intRegFee + intCostPerDay
    lstCost.Items.Add("Workshop Total :$" & intWorkshopCost)

Can someone please help me program the calculate total button?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.