# Collections

## Content

A *collection* is an object used to group similar data items, such as grid columns or styles. In general, a group of similar items in **True DBGrid** is implemented as a collection. Since a collection is an object, it can be manipulated in code just like any other object. **True DBGrid in WinForms** exposes the following collections:

### [C1DataColumnCollection](/componentone/docs/win/online-truedbgrid/)

Contains zero or more [C1DataColumn](/componentone/docs/win/online-truedbgrid/) objects in a grid. The [C1TrueDBGrid](/componentone/docs/win/online-truedbgrid/) control and the [C1TrueDBDropDown](/componentone/docs/win/online-truedbgrid/) control both maintain a [C1DataColumnCollection](/componentone/docs/win/online-truedbgrid/) object to hold and manipulate [C1DataColumn](/componentone/docs/win/online-truedbgrid/) objects. This collection is contained under the C1TrueDBGrid object, and can be modified through the **C1TrueDBGrid Designer**. It can be accessed through the **Columns** property of the **True DBGrid for WinForms** controls.

### [C1DisplayColumnCollection](/componentone/docs/win/online-truedbgrid/)

Contains zero or more [C1DisplayColumn](/componentone/docs/win/online-truedbgrid/) objects in a grid. The [C1TrueDBGrid](/componentone/docs/win/online-truedbgrid/) control and the [C1TrueDBDropDown](/componentone/docs/win/online-truedbgrid/) control both maintain a [C1DisplayColumnCollection](/componentone/docs/win/online-truedbgrid/) object to hold and manipulate [C1DisplayColumn](/componentone/docs/win/online-truedbgrid/) objects. This collection is contained under the [Split](/componentone/docs/win/online-truedbgrid/) object, and is available through the Split's [DisplayColumns](/componentone/docs/win/online-truedbgrid/) property. In addition, this collection can be modified in .NET through the **C1DisplayColumnCollection Editor**.

### [GroupedColumnCollection](/componentone/docs/win/online-truedbgrid/)

Contains zero or more [C1DataColumn](/componentone/docs/win/online-truedbgrid/) objects in the grouping area. When the [DataView](/componentone/docs/win/online-truedbgrid/) property is set to [DataViewEnum.GroupBy](/componentone/docs/win/online-truedbgrid/), a grouping area is created above the grid. This collection object represents the columns ([C1DataColumn](/componentone/docs/win/online-truedbgrid/) object) in the grouping area. As columns are dragged into or dragged out of the grouping area, the corresponding column in the collection will be added or deleted.

### [SelectedRowCollection](/componentone/docs/win/online-truedbgrid/)

Contains zero or more selected row indexes. When the user selects and highlights one or more rows of a [C1TrueDBGrid](/componentone/docs/win/online-truedbgrid/) control at run time, the row index of the selected rows are stored in the [SelectedRowCollection](/componentone/docs/win/online-truedbgrid/) object. In code, the [Item](/componentone/docs/win/online-truedbgrid/) property and [IndexOf](/componentone/docs/win/online-truedbgrid/) method of the collection can be used to determine which rows are selected. Also select and deselect records programmatically using its [Add](/componentone/docs/win/online-truedbgrid/) and [RemoveAt](/componentone/docs/win/online-truedbgrid/) methods.

### [SelectedColumnCollection](/componentone/docs/win/online-truedbgrid/)

Contains zero or more [C1DataColumn](/componentone/docs/win/online-truedbgrid/) objects that represent selected columns. When the user selects and highlights one or more columns of a [C1TrueDBGrid](/componentone/docs/win/online-truedbgrid/) control at run time, the [C1DataColumn](/componentone/docs/win/online-truedbgrid/) objects for those rows are stored in the [SelectedColumnCollection](/componentone/docs/win/online-truedbgrid/) object. In code, use the [Item](/componentone/docs/win/online-truedbgrid/) property and [IndexOf](/componentone/docs/win/online-truedbgrid/) method of the collection to determine which rows are selected. Also select and deselect records programmatically using its [Add](/componentone/docs/win/online-truedbgrid/) and [RemoveAt](/componentone/docs/win/online-truedbgrid/) methods.

### [SplitCollection](/componentone/docs/win/online-truedbgrid/)

Contains one or more [Split](/componentone/docs/win/online-truedbgrid/) objects in a grid. The [C1TrueDBGrid](/componentone/docs/win/online-truedbgrid/) control maintains a [SplitCollection](/componentone/docs/win/online-truedbgrid/) collection to hold and manipulate [Split](/componentone/docs/win/online-truedbgrid/) objects. A grid has one split by default, but may contain multiple splits. This collection is accessed using the [Splits](/componentone/docs/win/online-truedbgrid/) property of the C1TrueDBGrid. In addition this collection can be modified in .NET through the **Split Collection Editor**.

### [GridStyleCollection](/componentone/docs/win/online-truedbgrid/)

Contains built-in and user-defined [Style](/componentone/docs/win/online-truedbgrid/) objects for a grid. The [C1TrueDBGrid](/componentone/docs/win/online-truedbgrid/) and [C1TrueDBDropDown](/componentone/docs/win/online-truedbgrid/) controls store all built-in and user-defined [Style](/componentone/docs/win/online-truedbgrid/) objects in the [GridStyleCollection](/componentone/docs/win/online-truedbgrid/) object. Access the members of this collection by name in code, and then apply them to a grid, column, or split in order to control the appearance of the object in question. This collection is accessed using the [Styles](/componentone/docs/win/online-truedbgrid/) property in the **True DBGrid for WinForms** controls.

### [ValueItemCollection](/componentone/docs/win/online-truedbgrid/)

Contains zero or more [ValueItem](/componentone/docs/win/online-truedbgrid/) objects for a column. Each [C1DataColumn](/componentone/docs/win/online-truedbgrid/) object within a [C1TrueDBGrid](/componentone/docs/win/online-truedbgrid/) or [C1TrueDBDropDown](/componentone/docs/win/online-truedbgrid/) control stores its set of display value/value pairs in objects called [ValueItem](/componentone/docs/win/online-truedbgrid/) objects. The [ValueItemCollection](/componentone/docs/win/online-truedbgrid/) object is a collection of these pairs. This collection can be accessed through the [Values](/componentone/docs/win/online-truedbgrid/) property of the [ValueItems](/componentone/docs/win/online-truedbgrid/) object. For instance, in order to alter the first [ValueItem](/componentone/docs/win/online-truedbgrid/) in the collection, the code would look like: 

```csharp
this.c1TrueDBGrid.Columns[0].ValueItems.Values[0].DisplayValue = "Canada";                                                                  
```