Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
How can I make event UltraWinGrid, When active cell's key code is 'Enter' then automatically invoke AfterCellUpdate event?
posted

Hi,

I want to make validate code in AfterCellUpdate event and When user input 'Enter' key then KeyDown event catch it, purform AfterCellUpdate event.

 

This is code.

        private void UltraWInGrid_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                 //Here, I want to invoke AfterCellUpdate event
            }
        }

When user input some keys on active cell and input 'Enter' key or click other cell, I want to handle with same validation.

What is best way? is there other good way to validate those case?

Parents
No Data
Reply
  • 69832
    Suggested Answer
    Offline posted

    What you might want to consider is, rather than actually raising the event, you could simply call the event handler method directly.

    Example:

    this.ultraGrid.KeyDown += new KeyEventHandler(ultraGrid_KeyDown);

    void ultraGrid_KeyDown(object sender, KeyEventArgs e)
    {           
        if ( e.KeyData == Keys.Enter )
        {
            UltraGrid grid = sender as UltraGrid;
            UltraGridCell activeCell = grid.ActiveCell;

            if ( activeCell != null )
            {
                CellEventArgs args = new CellEventArgs( activeCell );
                this.grid_AfterCellUpdate( grid, args );
            }

        }
    }

    void grid_AfterCellUpdate(object sender, CellEventArgs e)
    {
    }

Children
No Data