与Listbox相同的运算符&数学不正常

时间:2013-02-12 21:05:56

标签: vb.net math listbox equals

我完成了老师要求的作业。数学计算不计算它应该是什么。数学正在努力处理压力,时间管理和监督技能。当我进入谈判,以及如何采访。我得到随机数。 如何采访(395)+达拉斯(110)= 505 但是我得到725.我认为它正在做395 +(110x3)。

Public Class frmMain
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim Workshops As New ArrayList()
    Workshops.Add(New Workshop("Handling Stress", "595"))
    Workshops.Add(New Workshop("Time Management", "695"))
    Workshops.Add(New Workshop("Supervision Skills", "995"))
    Workshops.Add(New Workshop("Negotiation", "1295"))
    Workshops.Add(New Workshop("How to Interview", "395"))
    lbWorkshop.DataSource = Workshops
    lbWorkshop.DisplayMember = "Workshop"
    lbWorkshop.ValueMember = "Price"
    lbWorkshop.ClearSelected()

    Dim Location As New ArrayList()
    Location.Add(New Workshop("Austin", "95"))
    Location.Add(New Workshop("Chicago", "125"))
    Location.Add(New Workshop("Dallas", "110"))
    Location.Add(New Workshop("Orlando", "100"))
    Location.Add(New Workshop("Phoenix", "92"))
    Location.Add(New Workshop("Raleigh", "90"))
    lbLocation.DataSource = Location
    lbLocation.DisplayMember = "Workshop"
    lbLocation.ValueMember = "Price"
    lbLocation.ClearSelected()

End Sub

Private Sub lblAdd_Click(sender As Object, e As EventArgs) Handles lblAdd.Click


    Dim description As String
    Dim value As Integer

    If (lbWorkshop.SelectedIndex > -1) Then
        If (lbLocation.SelectedIndex > -1) Then
            lblStatus1.Text = String.Empty
            If (lbWorkshop.SelectedItem.Equals("How to Interview")) Then
                value = lbWorkshop.SelectedValue + lbLocation.SelectedValue
            ElseIf (lbWorkshop.SelectedItem.Equals("Negotiation")) Then
                value = lbWorkshop.SelectedValue + (lbLocation.SelectedValue * 5)
            Else
                value = lbWorkshop.SelectedValue + (lbLocation.SelectedValue * 3)
            End If
            description = value.ToString

            lbTotal.Items.Add(description)
            lbTotal.ValueMember = value

            Dim total As Integer
            For Each Str As String In lbTotal.Items
                total = total + CInt(Str)
            Next
            lblTotal.Text = FormatCurrency(total.ToString)
        Else
            lblStatus1.Text = "Please Select a Location"
        End If
    Else
        lblStatus1.Text = "Please Select a Workshop"
    End If

End Sub

1 个答案:

答案 0 :(得分:1)

据我所知,它正在按照你的要求行事。这是你的意图吗?

       Else  'Supervision Skills, Negotiation, How to Interview
            value = lbWorkshop.SelectedValue + (lbLocation.SelectedValue * 3)