Articles in this section

How to read the cell value while the cell is still in edit mode of WinForms Spreadsheet?

Read the cell value in edit mode

WinForms Spreadsheet (SfSpreadsheet) provides support to read the cell value while the cell is in edit mode. You can get the value of current cell in edit mode by hooking CurrentCellValueChanged event and accessing the value from ControlText property. The CurrentCellValueChanged event will be triggered when entering each and every character into the cell.

Spreadsheet.ActiveGrid.CurrentCellValueChanged += ActiveGrid_CurrentCellValueChanged;

private void ActiveGrid_CurrentCellValueChanged(object sender,CurrentCellValueChangedEventArgs args)
{
    var cellvalue = args.ControlText; // Gets the text of cell in edit mode
}
You can also get the value of edited cell by using CurrentCellValidating event. For this, you need to call the Validate method of SpreadsheetCurrentCell.
//This call will trigger the CurrentCellValidating event.
Spreadsheet.ActiveGrid.CurrentCell.Validate(out isValid);
Spreadsheet.ActiveGrid.CurrentCellValidating += ActiveGrid_CurrentCellValidating;

bool isValid = true;

private void ActiveGrid_CurrentCellValidating(object sender,CurrentCellValidatingEventArgs args)
{
    var cellvalue = args.NewValue; // Gets the value of cell in edit mode  
}
Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied