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.Contains (String)

Gets a value indicating whether the TBD contains the DataGridColumn with the specified name.

[Visual Basic]
Overloads Public Function Contains( _
   ByVal name As String _
) As Boolean
[C#]
public bool Contains(
   string name
);
[C++]
public: bool Contains(
   String* name
);
[JScript]
public function Contains(
   name : String
) : Boolean;

Parameters

name
The Header of the desired DataGridColumn.

Return Value

true if the collection contains the DataGridColumn; otherwise, false.

Remarks

The name of a DataGridColumn is set with the Header property.

Use the Contains method to determine if a particular DataGridColumn object exists before invoking the Remove method to remove the item. If you need to know the index of a particular DataGridColumn, use the IndexOf method.

Example [Visual Basic]

The following example uses the Contains method to determine if a DataGridColumn with a given name exists in the GridColumnsCollection. If so, the code prints the value of the first row in the grid using the GetColumnValueAtRow method.

[Visual Basic]

Private Sub GetThisColumn()
   Dim trueOrFalse As Boolean
   Dim findString As String
   findString = "FName"
   trueOrFalse = DataGrid1.GridColumns.Contains(findString)
   If trueOrFalse Then
      Debug.Print DataGrid1.GridColumns(findString). _
      GetColumnValueAtRow(DataGrid1.DataSource, 0)
   End If
End Sub

See Also

GridColumnsCollection Class | GridColumnsCollection Members | System.WinForms Namespace | GridColumnsCollection.Contains Overload List | DataColumn | IndexOf | Item | Remove