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:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' Remove the Split object with index 1. Me.C1TrueDBGrid1.Columns(0).ValueItems.Values.RemoveAt(1) |
To write code in C#
C# |
Copy Code
|
---|---|
// Remove the Split object with index 1. this.c1TrueDBGrid1.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.