Home Forums WinForms controls Xceed Grid for WinForms keyboard events Reply To: keyboard events

User (Old forums)
Member
Post count: 23064

Hi,

Inorder to handle the keyboard events i implemented the following code

Private Sub CreateTextBoxes(ByVal paramName As String, ByVal index As Integer)

Dim dataRow As DataRow

dataRow = GridControl1.DataRows.AddNew()

Dim txtBox As New WinTextBox()

Dim txtEditor As New TextEditor(txtBox)

Dim txtViewer As New TextViewer(txtBox)

AddHandler txtEditor.ActivatingControl, AddressOf txtEditor_ActivatingControl

AddHandler txtEditor.DeactivatingControl, AddressOf txtEditor_DeactivatingControl

dataRow.Cells(“Value”).CellEditorManager = txtEditor

dataRow.Cells(“Value”).CellViewerManager = txtViewer

dataRow.Cells(“Parameter”).Value = paramName

dataRow.EndEdit()

End Sub

 

 Private Sub txtEditor_ActivatingControl(ByVal sender As Object, ByVal e As CellEditorEventArgs)

Dim txtBox As WinTextBox = CType(e.Control, WinTextBox)

AddHandler txtBox.KeyPress, AddressOf txtBox_keypress

End Sub

 

 Private Sub txtEditor_DeactivatingControl(ByVal sender As Object, ByVal e As CellEditorEventArgs)

Dim txtBox As WinTextBox = CType(e.Control, WinTextBox)

RemoveHandler txtBox.KeyPress, AddressOf txtBox_keypress

End Sub

 

Private

Sub txtBox_keypress(ByVal sender As Object, ByVal e As KeyPressEventArgs)

Dim a As Integer = GridControl1.DataRows.Count

End Sub

 On mouse click of the cell the event “txtEditor_ActivatingControl” is executing but on keypress in that cell (textbox), txtBox_keypress event is not executing.

Please advise me on this.

Imported from legacy forums. Posted by pravi (had 491 views)