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.

Out of range error - again

Thread ID:

Created:

Updated:

Platform:

Replies:

8395 Nov 5,2003 02:46 AM Nov 5,2003 06:23 AM Windows Forms 4
loading
Tags: GridControl
Per Millard
Asked On November 5, 2003 02:46 AM

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 Regards Per Millard Senior Software Architect PBJ Consult A/S Denmark

Administrator [Syncfusion]
Replied On 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?

Per Millard
Replied On November 5, 2003 05:24 AM

Sorry ... my fault ... seems to be the wrong project .. this should be the right example Per > 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?

Administrator [Syncfusion]
Replied On 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.

Per Millard
Replied On November 5, 2003 06:23 AM

Thanx Clay 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 Regards Per

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.

;