J
Jonathan Crawford
Hi
I have a data grid with a fdata button which has three event handlers
I set the event handlers in code when I reset the table style. This works
perfectly
the first time. Unfortunately I have to reset the tablestyles regularly.
Each time
this happens something goes wrong and and HandleCellButtonClick event fires
an extra time. So if I set reset the table stles 5 time when I click the
button in
the datagrid, it is the eqivalent of clicking it five times (ie five
messageboxes)
I have tried removing the events before creating them, but this has not
effect
I am at a loss to understand this and can find no reason for this
Please, i would be grateful for some assistence
thanks
jonathan
Private WithEvents buttonColStyle As
DataGridButtonColumn....
buttonColStyle = New DataGridButtonColumn(i)
buttonColStyle.HeaderText =
_dataSet.Tables("customers").Columns(i).ColumnName
buttonColStyle.MappingName =
_dataSet.Tables("customers").Columns(i).ColumnName
RemoveHandler buttonColStyle.CellButtonClicked,
AddressOf HandleCellButtonClick
AddHandler buttonColStyle.CellButtonClicked, AddressOf
HandleCellButtonClick
tableStyle.GridColumnStyles.Add(buttonColStyle)
RemoveHandler dataGrid1.MouseDown, AddressOf
buttonColStyle.HandleMouseDown
RemoveHandler dataGrid1.MouseUp, AddressOf
buttonColStyle.HandleMouseUp
AddHandler dataGrid1.MouseDown, AddressOf
buttonColStyle.HandleMouseDown
AddHandler dataGrid1.MouseUp, AddressOf
buttonColStyle.HandleMouseUp
Private Sub HandleCellButtonClick(ByVal sender As Object, ByVal e As
DataGridCellButtonClickEventArgs)
MessageBox.Show(("row " + e.RowIndex.ToString() + " col " +
e.ColIndex.ToString() + " clicked."))
End Sub
===============
Jonathan Crawford
01273 440018
07799 068570
fax 01273 380221
(e-mail address removed)
===============
I have a data grid with a fdata button which has three event handlers
I set the event handlers in code when I reset the table style. This works
perfectly
the first time. Unfortunately I have to reset the tablestyles regularly.
Each time
this happens something goes wrong and and HandleCellButtonClick event fires
an extra time. So if I set reset the table stles 5 time when I click the
button in
the datagrid, it is the eqivalent of clicking it five times (ie five
messageboxes)
I have tried removing the events before creating them, but this has not
effect
I am at a loss to understand this and can find no reason for this
Please, i would be grateful for some assistence
thanks
jonathan
Private WithEvents buttonColStyle As
DataGridButtonColumn....
buttonColStyle = New DataGridButtonColumn(i)
buttonColStyle.HeaderText =
_dataSet.Tables("customers").Columns(i).ColumnName
buttonColStyle.MappingName =
_dataSet.Tables("customers").Columns(i).ColumnName
RemoveHandler buttonColStyle.CellButtonClicked,
AddressOf HandleCellButtonClick
AddHandler buttonColStyle.CellButtonClicked, AddressOf
HandleCellButtonClick
tableStyle.GridColumnStyles.Add(buttonColStyle)
RemoveHandler dataGrid1.MouseDown, AddressOf
buttonColStyle.HandleMouseDown
RemoveHandler dataGrid1.MouseUp, AddressOf
buttonColStyle.HandleMouseUp
AddHandler dataGrid1.MouseDown, AddressOf
buttonColStyle.HandleMouseDown
AddHandler dataGrid1.MouseUp, AddressOf
buttonColStyle.HandleMouseUp
Private Sub HandleCellButtonClick(ByVal sender As Object, ByVal e As
DataGridCellButtonClickEventArgs)
MessageBox.Show(("row " + e.RowIndex.ToString() + " col " +
e.ColIndex.ToString() + " clicked."))
End Sub
===============
Jonathan Crawford
01273 440018
07799 068570
fax 01273 380221
(e-mail address removed)
===============