ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Adding Members

To create and add an object to a collection, use the collection's Add method. The method takes an object as its only argument. For example, create more valueitems for a column by adding new ValueItem objects to the ValueItemCollection object:

·      Visual Basic

' Create a ValueItem object.

Dim v As C1TrueDBGrid.ValueItem = new C1TrueDbGrid.ValueItem()

Me.C1TrueDBGrid1.Columns(0).ValueItems.Values.Add(v)

·      C#

// Create a ValueItem object.

C1TrueDBGrid.ValueItem v = new C1TrueDBGrid.ValueItem();

this.C1TrueDBGrid1.Columns[0].ValueItems.Values.Add(v);

·      Delphi

// Create a ValueItem object.

var S: C1TrueDBGrid.ValueItem;

 

Self.C1TrueDBGrid1.Columns[0].ValueItems.Values.Add(S);

This code adds a ValueItem object to the ValueItemCollection of C1TrueDBGrid1. Alternatively, create a ValueItem object with index 1 with the Insert method:

·      Visual Basic

' Create a Split object with index 1.

Dim S As C1TrueDBGrid.ValueItem

Me.TrueDBGrid1.Columns(0).ValueItems.Insert(1, S)

·      C#

// Create a Split object with index 1.

C1TrueDBGrid.ValueItem S;

this.TrueDBGrid1.Columns[0].ValueItems.Insert(1, S);

·      Delphi

// Create a Split object with index 1.

var S: C1TrueDBGrid.ValueItem;

 

Self.TrueDBGrid1.Columns[0].ValueItems.Insert(1, S);

The only object that is unable to add or remove members using the Add or RemoveAt methods is the Split object. InsertHorizontalSplit / RemoveHorizontalSplit and InsertVerticalSplit / RemoveVerticalSplit methods of the split object must be used to correctly add or remove Splits. These methods are also available in the grid’s right-click context menu at design time.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.