Regardless of how a collection implements the Add or Insert methods, the syntax for removing items is the same. To remove an existing item from a collection, use the RemoveAt method:
' Remove the Split object with index 1.
Me.TrueDBGrid1.Columns(0).ValueItems.Values.RemoveAt(1)
· C#
// Remove the Split object with index 1.
this.TrueDBGrid1.Columns[0].ValueItems.Values.RemoveAt(1);
· Delphi
// Remove the Split object with index 1.
Self.TrueDBGrid1.Columns[0].ValueItems.Values.RemoveAt(1);
After this statement is executed, all splits with collection indexes greater than 1 will be shifted down by 1 to fill the place of the removed split. Note that the RemoveAt method’s parameter is the location of the member to be removed.
Send comments about this topic to ComponentOne. Copyright © ComponentOne LLC. All rights reserved. |