Calculation

Workshop Selector Calculation Help

Page 1 of 1

1 Replies - 1725 Views - Last Post: 04 December 2010 - 06:14 PM Rate Topic: -----

#1 lluan22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-November 10

Calculation

Posted 01 December 2010 - 10:32 PM

Im Having trouble getting the price info from the listbox to the totalCost label, Can anyone please give me a couple pointers?

 Dim selectedWorkshopIndex As Integer = lbxWorkShop.SelectedIndex
        If selectedWorkshopIndex < 0 Then
            MessageBox.Show("Please select a workshop.")
            Return

        ElseIf lbxWorkShop.SelectedItem = "Handling Stress" Then                    '***Handling Stress***'
            intDays = 3
            intRegFee = 595
        ElseIf lbxWorkShop.SelectedItem = "Time Management" Then                    '*** Time Management ***'
            intDays = 3
            intRegFee = 695
        ElseIf lbxWorkShop.SelectedItem = "Supervision Skills" Then                 '*** Supervision Skills***'
            intDays = 3
            intRegFee = 995
        ElseIf lbxWorkShop.SelectedItem = "Negotiation" Then                        '*** Negotiation***'
            intDays = 5
            intRegFee = 1295
        ElseIf lbxWorkShop.SelectedItem = "How to Interview" Then                   '*** How to Interview ***'
            intDays = 1
            intRegFee = 395
        End If

        Dim selectedLocationIndex As Integer = lbxLocation.SelectedIndex
        If selectedLocationIndex < 0 Then
            MessageBox.Show("Please select a workshop.")
            Return

        ElseIf lbxLocation.SelectedItem = "Austin" Then                              '*** Austin Location ***'
            intLodging = intDays * 95
        ElseIf lbxLocation.SelectedItem = "Chicago" Then                             '*** Chicago Location ***'
            intLodging = intDays * 125
        ElseIf lbxLocation.SelectedItem = "Dallas" Then                              '*** Dallas Location ***'
            intLodging = intDays * 110
        ElseIf lbxLocation.SelectedItem = "Orlando" Then                             '*** Orlando Location ***'
            intLodging = intDays * 100
        ElseIf lbxLocation.SelectedItem = "Phoenix" Then                             '*** Phoenix Location ***'
            intLodging = intDays * 92
        ElseIf lbxLocation.SelectedItem = "Raleigh" Then                             '*** Raleigh Location ***'
            intLodging = intDays * 90
        End If

        '*** Transfering To List of Cost Box ***'
        lstOut.Items.Add(lbxLocation.SelectedItem.ToString + ControlChars.Tab & intLodging.ToString("c0"))
        lstOut.Items.Add(lbxWorkShop.SelectedItem.ToString + ControlChars.Tab & intRegFee.ToString("c0"))





    End Sub
    Private Sub btnCalculateTotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateTotal.Click
        Dim dblTotalCost As Double
        Dim intRegFee As Integer
        Dim intLodging As Decimal

        For intRegFee = 0 To Me.lbxWorkShop.Items.Count < 0
            intLodging = lbxWorkShop.Items(intRegFee).ToString.IndexOf("$")
            dblTotalCost += CDbl(lbxWorkShop.SelectedItems(intRegFee).ToString.Substring(intLodging, lbxLocation.Items(intRegFee).ToString.Length - intLodging))

        Next

        lblTotalCost.Text = CStr(dblTotalCost)

    End Sub


This post has been edited by macosxnerd101: 02 December 2010 - 06:17 AM
Reason for edit:: Please use code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Calculation

#2 reyben_89  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 69
  • Joined: 30-November 08

Re: Calculation

Posted 04 December 2010 - 06:14 PM

i think there something wrong with your calculation. during calculation make sure there's no any text included to avoid the error

This post has been edited by reyben_89: 04 December 2010 - 06:15 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1