Home Forums WinForms controls Xceed Grid for WinForms Problem assigning value to cell in insertation row. Reply To: Problem assigning value to cell in insertation row.

User (Old forums)
Member
Post count: 23064

You should do this on the editor that is editing the InsertionCell as the user types something.

e.g.:

private void Form1_Load( object sender, EventArgs e )

{

    foreach( InsertionCell cell in insertionRow1.Cells )

    {

        cell.CellEditorManager.ActivatingControl +=

new CellEditorEventHandler(CellEditorManager_ActivatingControl);

        cell.CellEditorManager.DeactivatingControl +=

new CellEditorEventHandler( CellEditorManager_DeactivatingControl );

    }

}

 

void CellEditorManager_ActivatingControl( object sender, CellEditorEventArgs e )

{

    ( ( WinTextBox )e.Control ).TextBoxArea.KeyUp += new KeyEventHandler( TextBoxArea_KeyUp );

}

void TextBoxArea_KeyUp( object sender, KeyEventArgs e )

{

    if( e.KeyCode == Keys.Multiply )

    {

        ( ( TextBoxArea )sender ).Text = “some text”;

        ( ( TextBoxArea )sender ).SelectAll();

    }

}

void CellEditorManager_DeactivatingControl( object sender, CellEditorEventArgs e )

{

    ( ( WinTextBox )e.Control ).TextBoxArea.KeyUp -= new KeyEventHandler( TextBoxArea_KeyUp );

}

 

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