I've already posted an issue regarding out-of-range errors when trying to access a cell in a virtual grid, where row and col counts are provided by Query event handlers. When accessing cells outside the QueryCellInfo handler, the grid seems to limit its range of available cells to the number of rows and cols supplied at creation time and not the one supplied by subsequent calls to the query?count event handlers thus the grid will raise an out of range exception trying to access cells outside the initial range, regardless of the fact the the RowCount and ColCount properties indicates a larger range available.
I've added an example, where a virtual grid is manually created in form_load, and ResetVolatileData is called to force the grid to update its row and col counts using Query?Count event handlers. A button is added, that tries to modify a cell value somewhere within the range of cells. This causes an out of range error, regardsless of the fact, that row and col index seems to be inside the range of cells now shown by the grid. A commented line has been added to the form_load method, setting the initial value of rowcount to 1000, and suddenly the grid allows the cell to be modified. This must be an error .. or perhaps i've overlooked something
You need to have Syncfusion 1.6 installed to compile the example
Senior Software Architect
PBJ Consult A/S
ADAdministrator Syncfusion Team November 5, 2003 05:16 AM
Did you attach the sample you intended to attach?
This sample has references to other 3rd party controls, but no Syncfusion references in it.
Or, am I missing something?
PMPer MillardNovember 5, 2003 05:24 AM
Sorry ... my fault ... seems to be the wrong project .. this should be the right example
> Did you attach the sample you intended to attach?
> This sample has references to other 3rd party controls, but no Syncfusion references in it.
> Or, am I missing something?
ADAdministrator Syncfusion Team November 5, 2003 06:09 AM
Thank you for your sample.
Dynamically providing rowcount in QueryRowCount does not allocate storage inside the grid. Explicitly setting grid.RowCount = xxx, does allocate storage to hold values.
So normally, if you handle QueryRowCount, you would also handle QueryCellInfo and SaveCellInfo to avoid the need for internal storage in your grid. Instead, you would use your external data store to get and set values into the grid with these additional two events.
In your sample, you handle QueryRowCount you set the row count, but you are relying on the default SaveCellInfo behavior which expects the data store to be allocated in the grid to hold data. This is why you are getting the exception.
So, if you do want the grid to hold the data, there is no need for QueryRowCount, you can just explicitly set grid.RowCount an this allows things to work.
If you want the data to be stored in your m_data object, then you need to add QueryCellInfo and SaveCellInfo handlers to implement this behavior. And, this will avoid the problem you are seeing.
Attached is your sample back with this modification. Since your m_data was just an array of strings, the sample just uses the single string for every value on the row.
PMPer MillardNovember 5, 2003 06:23 AM
I think I get the picture. This is probably also why I have some problems with a checkbox i've added. The checkbox can't store its state, since no cell storage is allocated.
Its really kinda obvious when you think of it ..
Thanx again, I might get back to you if I run in to other problems ... I hope you don't mind