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

ClearCells ?

Thread ID:





67980 Sep 5,2007 07:44 PM UTC Sep 6,2007 08:23 PM UTC WinForms 3
Tags: GridControl
Philip Bishop
Asked On September 5, 2007 07:44 PM UTC

Is there any way faster to clear a grid then using

grd1.ClearCells(GridRangeInfo.Table, False)

I have 4 grids on one form. When I click a button that clears all four it takes about 8 seconds. I have a sample attached. If you click the clear button and then wait you will see how long it takes. Is this normal or am I doing something wrong? If I set visible=false on all the grids it seems to maybe cut off a second. Any ideas or is this just normal?

Also when trying to view code sometimes on this form with 4 grids it seems to be way slower bringing up the code then other forms with one grid. Is this because of all the styleinfo I see in the windows generated code?

Thanks in advance.


Rajagopal [Syncfusion]
Replied On September 6, 2007 02:21 AM UTC

Hi Philip,

The grid.ClearCells() method is used to clear the contents and leave the rows. When you have more number of cells to be cleared, this time delay is likely to occur. The other way of achieving this is by resetting the rowcount for the grid. Please try the below code in your sample.

Private Sub ResetGrid(ByVal grid As GridControl)
Dim c As Integer = grid.RowCount
grid.RowCount = 0
grid.RowCount = c
End Sub

// button_Click event handler

Let me know if this helps.


Philip Bishop
Replied On September 6, 2007 01:15 PM UTC

Ok that does clear the grids in a second or less but it loses all my cell info I set up in the designer such as currency cell type. It loses it all. Is there a way to do that and not lose all of that?

Rajagopal [Syncfusion]
Replied On September 6, 2007 08:23 PM UTC

Hi Philip,

To retain the styleinfo settings associated with each cell, you can serialize the grid without the cellvalue to an xml file and load the grid later from the xml file. In general, when you serialize the grid the CellValue will also get serialized as it is a part of GridStyleInfo object. We can avoid this getting serialized by subscribing to the GridStyleInfoStore.CellValueProperty.WriteXml event and ignore writing out the cell value there.

Please refer the below sample for more information

Let me know if this helps.



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