Home Forums WinForms controls Xceed Grid for WinForms How can I get a KeyCode while edit a cell in vb.net

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16718 |

    Hi.

    I want to catch a keycode while entering any value in currentcell.

    is it posible to catch it.

    Thanx in adv.

    Imported from legacy forums. Posted by Kapil (had 474 views)

    User (Old forums)
    Member
    Post count: 23064

    You can handle the QueryInputKey event on the Column’s CellEditorManager :

    foreach( Column col in gridControl1.Columns )

    {

        col.CellEditorManager.QueryInputKey +=

    new QueryEditorInputKeyEventHandler(CellEditorManager_QueryInputKey);

    }

    void CellEditorManager_QueryInputKey( object sender, QueryEditorInputKeyEventArgs e )

    {

        System.Diagnostics.

    Debug.WriteLine( e.KeyData.ToString() );

    Note however that when a key is press to enter edition (instead of a mouse click), the first key will not be processed by this event, so you need to handle the KeyPress on the cell itself to get the first key :

    foreach( Cell cell in dataRowTemplate1.Cells )

    {

        cell.KeyPress +=

    new KeyPressEventHandler( cell_KeyPress );

    void cell_KeyPress( object sender, KeyPressEventArgs e )

    {

        System.Diagnostics.

    Debug.WriteLine( e.KeyChar.ToString() );

    }

     

    Imported from legacy forums. Posted by André (had 803 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.