【发布时间】:2012-09-12 14:16:33
【问题描述】:
我正在尝试更新数据网格视图和图表。
我有一个类,在那个类中我有一个从数据库返回数据表的函数。
我需要 bindingSource,因为这是我更新图表(条形图)的方式
不幸的是,当图表是饼图时,我需要使用数据表进行更新
所以当我加载我的表单时:
gbsGraph.DataSource = graphFunctions.prepareData() 'gbsGraph is a BindingSource
gdtGraphData = graphFunctions.prepareData() 'gdtGraphData isDataTable
gdv.DataSource = gbsGraph 'gdv is my datagridview
AddHandler gdtGraphData.RowChanged, AddressOf gdtGraphData_RowChanged 'add event for update piechart
fillChart()'code to fill the chart
当用户按下刷新按钮时:
Private Sub tsmiRefresh_Click(sender As System.Object, e As System.EventArgs) Handles tsmiRefresh.Click
gbsGraph.DataSource = graphFunctions.prepareData()' this works and dgv and my bar charts are updated
gdtGraphData = graphFunctions.prepareData() 'this is should trigger the event gdtGraphData.RowChanged but it doesn't
End Sub
我的 DataRowChange 自定义事件:
Private Sub gdtGraphData_RowChanged(ByVal sender As Object, ByVal e As DataRowChangeEventArgs)
'Here is code to refill the Pie chart
'but the event isn't fired
End Sub
所以我的问题是如何更新我的数据表并触发 gdtGraphData_RowChanged 事件?
谢谢 T
【问题讨论】: