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.
Unfortunately, activation email could not send to your email. Please try again.

ClearCells ?

Thread ID:

Created:

Updated:

Platform:

Replies:

67980 Sep 5,2007 03:44 PM Sep 6,2007 04:23 PM Windows Forms 3
loading
Tags: GridControl
Philip Bishop
Asked On September 5, 2007 03:44 PM

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.



MultipleGridsShowingProb1.zip

Rajagopal [Syncfusion]
Replied On September 5, 2007 10:21 PM

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)
grid.BeginUpdate()
Dim c As Integer = grid.RowCount
grid.RowCount = 0
grid.RowCount = c
grid.EndUpdate(True)
End Sub

// button_Click event handler
ResetGrid(gridControl1)
ResetGrid(gridControl2)
ResetGrid(gridControl3)
ResetGrid(gridControl4)

Let me know if this helps.

Regards,
Rajagopal

Philip Bishop
Replied On September 6, 2007 09:15 AM

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 04:23 PM

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
http://www.syncfusion.com/Support/user/uploads/GC_ResetGrid_1e54d860.zip

Let me know if this helps.

Regards,
Rajagopal

CONFIRMATION

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.

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.

;