Combolist框到列表框计数器无法重置为零

时间:2015-02-06 20:39:12

标签: visual-studio listbox

所以我将数据从数组加载到combolist框中,然后将其加载到我的列表框中。我也在增加&递减值,因为它们被取消选中并检查但是我似乎无法达到0似乎1是最小值。我尝试添加checkstate.unchecked并删除我的for循环,但它变得一团糟。

 Private Sub combolistbox_ItemCheck(sender As Object, _e As ItemCheckEventArgs) Handles cblCourses.ItemCheck
    Dim item As String
    Dim price As Integer = 0
    Dim Amount1 As Integer = 0
    Dim Amount2 As Integer = 0


    item = combolistbox.SelectedItem.ToString()


    If (_e.NewValue = CheckState.Checked) Then
        If Not listbox.Items.Contains(item) Then

            listbox.Items.Add(item)
        End If
    Else
        listbox.Items.Remove(item)
    End If


    For i = 0 To job_1.Length - 1

        If listbox.Items.Contains(job_1(i)) Then
            price += dayCourse
            label_bulk.Text = FormatCurrency(price)
            Amount1 += 1
            label_Day.Text = (AmountDay1)
        End If
    Next


    For i = 0 To job_2.Length - 1

        If listbox.Items.Contains(job_2(i)) Then
            price += eveningCourse
            label_bulk.Text = FormatCurrency(price)
            Amount2 += 1
            label_Evening.Text = (Amount2)
        End If
    Next
End Sub

0 个答案:

没有答案