Datagrid Cell coloring

I am getting the following exception trace when using the datagrid coloumn color method (2)you've described. I must obviously be doing something wrong here and was looking for any ideas: Description: Datagrid is bound. I select on a sorted column and change the sorting by double clicking the column. Then app ( after user selects different data) re-populates the dataset and exact table_name with a new table ( which is empty ). At this point the following exception is thrown. Any help would be appreciated. Thanks, Ken ************** Exception Text ************** System.IndexOutOfRangeException: Cannot find column 3. at System.Data.DataColumnCollection.get_Item(Int32 index) at System.Data.DataView.System.ComponentModel.IBindingList.get_SortProperty() at System.Windows.Forms.CurrencyManager.GetSortProperty() at System.Windows.Forms.DataGrid.PaintColumnHeaderText(Graphics g, Rectangle boundingRect) at System.Windows.Forms.DataGrid.PaintColumnHeaders(Graphics g) at System.Windows.Forms.DataGrid.PaintGrid(Graphics g, Rectangle gridBounds) at System.Windows.Forms.DataGrid.OnPaint(PaintEventArgs pe) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

1 Reply

AD Administrator Syncfusion Team February 17, 2004 07:27 PM UTC

> I am getting the following exception trace when using the datagrid coloumn color method (2)you've described. I must obviously be doing something wrong here and was looking for any ideas: > > Description: > Datagrid is bound. I select on a sorted column and change the sorting by double clicking the column. > Then app ( after user selects different data) re-populates the dataset and exact table_name with a new table ( which is empty ). At this point the following exception is thrown. > > Any help would be appreciated. > Thanks, > Ken > > > > ************** Exception Text ************** > System.IndexOutOfRangeException: Cannot find column 3. > at System.Data.DataColumnCollection.get_Item(Int32 index) > at System.Data.DataView.System.ComponentModel.IBindingList.get_SortProperty() > at System.Windows.Forms.CurrencyManager.GetSortProperty() > at System.Windows.Forms.DataGrid.PaintColumnHeaderText(Graphics g, Rectangle boundingRect) > at System.Windows.Forms.DataGrid.PaintColumnHeaders(Graphics g) > at System.Windows.Forms.DataGrid.PaintGrid(Graphics g, Rectangle gridBounds) > at System.Windows.Forms.DataGrid.OnPaint(PaintEventArgs pe) > at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) > at System.Windows.Forms.Control.WmPaint(Message& m) > at System.Windows.Forms.Control.WndProc(Message& m) > at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) > at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) > at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) >

Loader.
Up arrow icon