The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have Grid.GridControl in which I've poplulated values, set formats etc.
I'd like to reset the grid with entirely new values and different formats programmatically.
I've tried a few things and could dispose of the control and add a new one, but is there a way to cleanly clear the grid and re-use the object that I've missed?
SHStefan Hoenig Syncfusion Team July 11, 2002 12:12 AM UTC
> I have Grid.GridControl in which I've poplulated values, set formats etc.
>
> I'd like to reset the grid with entirely new values and different formats programmatically.
>
> I've tried a few things and could dispose of the control and add a new one, but is there a way to cleanly clear the grid and re-use the object that I've missed?
>
One easy way is to set row and column count to zero, as for example:
gridControl1.RowCount = 0;
gridControl1.ColCount = 0;
After that set new row and column count and populate the grid.
- Or -
You simply attach a new data object:
gridControl1.Data = new Syncfusion.Windows.Forms.Grid.GridData();
gridControl1.UpdateScrollBars();
Stefan Hoenig
SHSam HortonJuly 11, 2002 10:07 AM UTC
> > I have Grid.GridControl in which I've poplulated values, set formats etc.
> >
> > I'd like to reset the grid with entirely new values and different formats programmatically.
> >
> > I've tried a few things and could dispose of the control and add a new one, but is there a way to cleanly clear the grid and re-use the object that I've missed?
> >
>
> One easy way is to set row and column count to zero, as for example:
>
> gridControl1.RowCount = 0;
> gridControl1.ColCount = 0;
>
> After that set new row and column count and populate the grid.
>
> - Or -
>
> You simply attach a new data object:
>
> gridControl1.Data = new Syncfusion.Windows.Forms.Grid.GridData();
> gridControl1.UpdateScrollBars();
>
> Stefan Hoenig
Thank you Stefan! I ended up having to clear a few things specific to the app as well to get the right behavior:
Me.Grid.ReadOnly = False
Me.Grid.Cols.RestoreFrozen()
Me.Grid.ColCount = 0
Me.Grid.RowCount = 0
.
. [re-populate]
.
Me.Grid.Refresh()
What task does the command gridControl1.UpdateScrollBars() perform which helps the process? I'm curious....
SHStefan Hoenig Syncfusion Team July 11, 2002 02:25 PM UTC
It just updates the scroll range information for the scrollbars and hides/shows scrollbars if necessary. This is necessary because when the data object is assigned, the view isnot refreshed and scrollbars would be out of sync.
Stefan