My program throws the following error when trying to add a Title to a GridColumn:
System.ArgumentOutOfRangeException: The index must be greater than or equal to 0 and less than Count. Parameter name: index
Inside the Debug Watch Pane, it shows the column count of the grid is 0:
grid.Columns.Count = 0
Here is my code:
Private
Sub buildGrid(ByRef grid As Xceed.Grid.GridControl, ByVal ds As DataSet)
grid.BeginInit()
grid.Clear()
grid.SynchronizeDetailGrids =
True
grid.SetDataBinding(ds, ds.Tables(0).TableName)
grid.FixedHeaderRows.Add(
New ColumnManagerRow())
Dim dgrid1 As New DetailGrid()
dgrid1.SetDataBinding(ds,
“Total.TotalDate”)
dgrid1.HeaderRows.Add(
New ColumnManagerRow())
dgrid1.Collapsed =
True
grid.DetailGridTemplates.Add(dgrid1)
grid.UpdateDetailGrids()
grid.Columns(EstGrid.Commodity).Title =
“Commodity” <—-Where error is thrown
When I look at the grid object in debug mode, I see that the datasource is set to the dataset I give to it. But I can’t figure out why no columns are being created. I’ve checked the dataSet and the tables have multiple rows/columns.
Imported from legacy forums. Posted by jzero (had 996 views)