We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Very high CPU usage when clearing cell data

Thread ID:





128110 Jan 3,2017 08:48 AM UTC Jan 3,2017 01:09 PM UTC WinForms 3
Tags: GridListControl
Asked On January 3, 2017 08:48 AM UTC

I have issues with a function that updates the ListGrid every 150ms from a IList<T>:
In the cells with data, I just update the value and the color (CurrentRow); for the remaining rows and cells I have this 2 nested fors to clear texx and color.

for (int r = CurrentRow; r < _ListGrid.RowCount; r++)
  for (int c = 1; c <= _ListGrid.ColCount; c++)
 _ListGrid.Model[r, c].CellValue = "";
 _ListGrid.Model[r, c].BackColor = Color.Transparent;
 _ListGrid.Model[r, c].TextColor = Color.Black;

This blocks the UI and uses a lot of CPU:

Is there a fastest way to clear cells? I've found this post with a similar problem but it's not my case.

Thank you for your help and time.


Replied On January 3, 2017 08:52 AM UTC

Sorry wrong image in the OP. That image is the report with the 2 for commented.
This is the correct image:

Replied On January 3, 2017 08:53 AM UTC


Sorry... There is no preview and no edit :D

Piruthiviraj Malaimelraj [Syncfusion]
Replied On January 3, 2017 01:09 PM UTC

Hi Daniele, 

Thanks for your interest in Syncfusion products. 

We have created the simple sample as per your requirement . To clear the cell values instead of assigning null values through iteration, ClearCells method of grid can be used. In this method, particular range of cells can be cleared  by using GridRangeInfo value. Please make use of the below code, 

Code example: 
int currentRow = this.gridControl1.CurrentCell.RowIndex; 
int rowCount = this.gridControl1.Model.RowCount; 
int colCount = this.gridControl1.Model.ColCount; 
this.gridControl1.Model.ClearCells(GridRangeInfo.Cells(currentRow, 1, rowCount, colCount), true); 
Please refer the below UG document for further references, 
Sample link: 
We would like to suggest to use VirtualGrid for your requirement. In VirtualGrid , all data will be supplied from external datasource at runtime. So you can use VirtualGrid to load the data on demand as per your scenario. 
Please refer to the below documents for further references, 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon