NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

GridColumnsCollection.Remove (Int32)

Removes the TBD with the specified index from the GridColumnsCollection.

[Visual Basic]
Overloads Public Sub Remove( _
   ByVal index As Integer _
)
[C#]
public void Remove(
   int index
);
[C++]
public: void Remove(
   int index
);
[JScript]
public function Remove(
   index : int
);

Parameters

index
The zero-based index of the DataGridColumn to remove.

Remarks

Use the IndexOf method to determine the index of any element in the collection.

Example [Visual Basic]

The following example uses the Contains method to determine if a given TBD exists in a GridColumnsCollection. If so, the IndexOf method returns the index of the DataGridColumn, and the Remove method is invoked with the index to remove the element from the collection.

[Visual Basic]

Private Sub RemoveCol(ByVal dc As DataColumn) 
   Dim dgCols As GridColumnsCollection
   Set dgCols = DataGrid1.GridColumns
   If dgCols.Contains(dc) Then
      Dim i As Integer
      i = dgCols.IndexOf(dgCols(dc))
      ' If it's not the 0-th element in the collection, remove it.
      If i > 0 Then dgCols.Remove i
   End If
End Sub

See Also

GridColumnsCollection Class | GridColumnsCollection Members | System.WinForms Namespace | GridColumnsCollection.Remove Overload List | Add | IndexOf