Home Forums WinForms controls Xceed Grid for WinForms checkbox event Reply To: checkbox event

User (Old forums)
Member
Post count: 23064

Thanks works well.

Just a few typos for others looking at this code:

AddHandler xg.Columns(“col4”).CellEditorManager.ActivatingControl, AddressOf CheckBoxEditor_ActivatingControl
AddHandler xg.Columns(“col4”).CellEditorManager.DeactivatingControl, AddressOf CheckBoxEditor_DeactivatingControl
End Sub

Private Sub CheckBoxEditor_ActivatingControl(ByVal sender As Object, ByVal e As Xceed.Grid.Editors.CellEditorEventArgs)

Dim editor As Xceed.Editors.WinCheckBox = CType(e.Control, Xceed.Editors.WinCheckBox)
AddHandler editor.CheckedChanged, AddressOf checkBox_CheckedChanged

End Sub

Private Sub CheckBoxEditor_DeactivatingControl(ByVal sender As Object, ByVal e As Xceed.Grid.Editors.CellEditorEventArgs)

Dim editor As Xceed.Editors.WinCheckBox = CType(e.Control, Xceed.Editors.WinCheckBox)
‘this needs to be done, if not, subscriptions will pill up every time the editor is activated
RemoveHandler editor.CheckedChanged, AddressOf checkBox_CheckedChanged

End Sub

Private Sub checkBox_CheckedChanged(ByVal sender As System.Object, ByVal e As EventArgs)
MessageBox.Show(CType(sender, WinCheckBox).CheckState.ToString())
‘ System.Diagnostics.Debug.WriteLine(CType(sender, WinCheckBox).CheckState.ToString())

End Sub

Imported from legacy forums. Posted by troy@querytool.com (had 952 views)