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. Image for the cookie policy date

"Specified argument was out of the range of valid values" messagebox from grid

In the attached form, I have a virtual grid that has a new base style defined called "FilterHeader" that is based on a column header. It's a combo box. When I change the value of the combo box and then try to select another cell, I get the "Specified argument was out of the range of valid values" messagebox from deep inside the grid. The only thing I can think that I could be doing wrong is the QueryCellInfo code? I boiled it down to the following: if (e.ColIndex==15 && e.RowIndex==0) { e.Style.BaseStyle="FilterHeader"; e.Style.ChoiceList=new StringCollection(); e.Style.ChoiceList.Add("a"); e.Style.ChoiceList.Add("b"); e.Handled=true; } Any help would be appreciated.

2 Replies

Administrator July 7, 2003 12:53 PM UTC

A couple of points. If you want the grid to store the header values for you, then you need to allocate some internal storage for this. Or, you could provide this header cell value in QueryCellInfo and save it in SaveCellInfo through some data item that you control. To use the grid's internal storage, you would need to set the column count on the grid's Data object.
public Form1()
{
	InitializeComponent();
	this.gridControl1.Model.Data.ColCount = 100; //could use only 17 if that is last column hedaer you want to populate
	gridControl1.ResetVolatileData();
}

Then in QueryCellInfo, you should not set e.Handled = true for this cell as you want to retrieve the saved value. Attached is a file with these changes that seems to work for me.

ED Eric Duesing July 7, 2003 02:37 PM UTC

As usual, you are correct. Thanks.
Loader.
Live Chat Icon For mobile
Up arrow icon