obtain content of editing cell

Posted by: manuelmedinaescareno on 4 July 2019, 9:11 am EST

  • Posted 4 July 2019, 9:11 am EST

    how do i obtain the text when im editing a cell por example if a cell is empty and i start editing, when i press the enter key, if a compare the text the content of the cell is empty
  • Replied 4 July 2019, 11:27 pm EST

    Hello,

    Did you try using the EditEnd event. This event fires when edit mode finishes and the sheet is about to enter normal mode. Also, it has Row and Column as its arguments that should help you fetch the edit value.

    Thanks,
    Ruchir
  • Replied 5 July 2019, 1:53 am EST

    but how do you ask if the enter key was pressed, in the EditEnd?
  • Replied 8 July 2019, 12:30 am EST

    Hi,

    If you want to detect when edit ends by Enter key press then you need to handle PreviewKeyDown event too. Similar to following:
            bool enterKey = false;
    private void Ss_PreviewKeyDown(object sender, KeyEventArgs e)
    {
    if (e.Key == Key.Enter)
    enterKey = true;
    }
    private void Ss_EditEnd(object sender, GrapeCity.Windows.SpreadSheet.UI.EditCellEventArgs e)
    {
    if(enterKey) // edit ending by Enter key press
    {
    //do action for Enter key
    enterKey = false;
    }
    }
    Thanks & Regards,
    Ruchir
  • Replied 9 July 2019, 2:40 am EST

    also how can i make the cell go to the next column when im editing i have done it when is over the cell but not when im editing it.
  • Marked as Answer

    Replied 9 July 2019, 10:24 pm EST

    Hello,
    As I understand, you wish to move to adjacent cell when you finish editing and press Enter key.
    If this is your requirement, you may either use Tab key or use SetActiveCell method with new cell indexes, as follows:
    private void Ss_EditEnd(object sender, GrapeCity.Windows.SpreadSheet.UI.EditCellEventArgs e)
    {
    if (enterKey) // edit ending by Enter key press
    {
    //do action for Enter key
    enterKey = false;
    ss.ActiveSheet.SetActiveCell(e.Row-1, e.Column+1);
    }
    }
    Best wishes,
    Ruchir
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels