Vb.net Listview项或子项onchange事件

Vb.net Listview项或子项onchange事件,vb.net,charts,controls,Vb.net,Charts,Controls,当我有一个包含46个项目的列表视图时,其中每个项目有4个子项目,子项目的值随时间变化,当使用以下代码选择列表视图中的项目时,我使用子项目的值绘制饼图: Chart1.Series("Series1").ChartType = SeriesChartType.Pie Chart1.Series("Series1").Points.Clear() If ListView3.FocusedItem.SubItems(1).Text > 0 Then Chart1.Series("Ser

当我有一个包含46个项目的列表视图时,其中每个项目有4个子项目,子项目的值随时间变化,当使用以下代码选择列表视图中的项目时,我使用子项目的值绘制饼图:

Chart1.Series("Series1").ChartType = SeriesChartType.Pie
Chart1.Series("Series1").Points.Clear()

If ListView3.FocusedItem.SubItems(1).Text > 0 Then
    Chart1.Series("Series1").Points.AddY(ListView3.FocusedItem.SubItems(1).Text)
End If
If ListView3.FocusedItem.SubItems(2).Text > 0 Then
    Chart1.Series("Series1").Points.AddY(ListView3.FocusedItem.SubItems(2).Text)
End If
If ListView3.FocusedItem.SubItems(3).Text > 0 Then
    Chart1.Series("Series1").Points.AddY(ListView3.FocusedItem.SubItems(3).Text)
End If
If ListView3.FocusedItem.SubItems(4).Text > 0 Then
    Chart1.Series("Series1").Points.AddY(ListView3.FocusedItem.SubItems(4).Text)
End If
有没有办法检测子项值的变化?类似于文本框中的
onchange
事件,但用于项或子项,因为我希望饼图在子项值更改时更新。 此代码更改子项

For xx As Integer = 0 To ListView3.Items.Count - 1
                If ListView3.Items(xx).SubItems(0).Text = googleXMLdocument...<s:name>(j).Value Then

                    If j + 1 = 1 Then
                        ListView3.Items(xx).SubItems(1).Text += 1

                    End If
                    If j + 1 = 2 Then
                        ListView3.Items(xx).SubItems(2).Text += 1
                    End If
                    If j + 1 = 3 Then
                        ListView3.Items(xx).SubItems(3).Text += 1
                    End If
                    If j + 1 > 4 Then
                        ListView3.Items(xx).SubItems(4).Text += 1
                    End If
                End If

            Next
将xx作为整数=0添加到ListView3.Items.Count-1
如果ListView3.Items(xx).SubItems(0).Text=googleXMLdocument…(j).Value,则
如果j+1=1,则
ListView3.Items(xx).SubItems(1).Text+=1
如果结束
如果j+1=2,则
ListView3.项目(xx).子项目(2).文本+=1
如果结束
如果j+1=3,则
ListView3.Items(xx).SubItems(3).Text+=1
如果结束
如果j+1>4,则
ListView3.项目(xx).子项目(4).文本+=1
如果结束
如果结束
下一个

试试这段代码。这样,如果子项中有任何更改,图表将自动更新。您不需要计时器

For xx As Integer = 0 To ListView3.Items.Count - 1
    If ListView3.Items(xx).SubItems(0).Text = googleXMLdocument...<s:name>(j).Value Then
        If j + 1 = 1 Then
            ListView3.Items(xx).SubItems(1).Text += 1
        End If
        If j + 1 = 2 Then
            ListView3.Items(xx).SubItems(2).Text += 1
        End If
        If j + 1 = 3 Then
            ListView3.Items(xx).SubItems(3).Text += 1
        End If
        If j + 1 > 4 Then
            ListView3.Items(xx).SubItems(4).Text += 1
        End If
    End If
Next

试试这个代码。这样,如果子项中有任何更改,图表将自动更新。您不需要计时器

For xx As Integer = 0 To ListView3.Items.Count - 1
    If ListView3.Items(xx).SubItems(0).Text = googleXMLdocument...<s:name>(j).Value Then
        If j + 1 = 1 Then
            ListView3.Items(xx).SubItems(1).Text += 1
        End If
        If j + 1 = 2 Then
            ListView3.Items(xx).SubItems(2).Text += 1
        End If
        If j + 1 = 3 Then
            ListView3.Items(xx).SubItems(3).Text += 1
        End If
        If j + 1 > 4 Then
            ListView3.Items(xx).SubItems(4).Text += 1
        End If
    End If
Next

项目/子项目如何更改?通过点击或通过代码手动操作?我已经使用了4个标签,每个标签包含一个子项的值和一个计时器,这样我就得到了一个实时图表…回答你的问题,它们随时间变化数据从google atom Feed解析而来。你不需要计时器:)我不知道我需要什么..我对这东西不熟悉:D..它无论如何都能工作,但如何工作你会在没有定时器的情况下完成吗?项目/子项目是如何变化的?通过点击或通过代码手动操作?我已经使用了4个标签,每个标签包含一个子项的值和一个计时器,这样我就得到了一个实时图表…回答你的问题,它们随时间变化数据从google atom Feed解析而来。你不需要计时器:)我不知道我需要什么..我对这东西不熟悉:D..它无论如何都能工作,但如何工作你能不用定时器吗?