Articles in this section
Category / Section

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

1 min read

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.

C#

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

C#

//This call will trigger the CurrentCellValidating event.
Spreadsheet.ActiveGrid.CurrentCell.Validate(out isValid);
Spreadsheet.ActiveGrid.CurrentCellValidating += ActiveGrid_CurrentCellValidating;
private void ActiveGrid_CurrentCellValidating(object sender,CurrentCellValidatingEventArgs args)
{
    var cellvalue = args.NewValue; // Gets the value of cell in edit mode  
}
bool isValid = true;

 

Conclusion

I hope you enjoyed learning on how to read the cell value while the cell is still in edit mode.

You can refer to our WPF Spreadsheet feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to present and manipulate data.

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our ASP.NET MVC Chart and other ASP.NET MVC components.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied