This documentation is archived and is not being maintained.

BindingContext.Contains Method

Gets a value indicating whether the BindingContext contains the specified BindingManagerBase.

Overload List

Gets a value indicating whether the BindingContext contains the BindingManagerBase associated with the specified data source.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Function Contains(Object) As Boolean
[C#] public bool Contains(object);
[C++] public: bool Contains(Object*);
[JScript] public function Contains(Object) : Boolean;

Gets a value indicating whether the BindingContext contains the BindingManagerBase associated with the specified data source and data member.

Supported by the .NET Compact Framework.

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

Example

The following example uses the Contains method to test whether a specific BindingManagerBase exists before attempting to get it through the Item property.

[Visual Basic] 
Private Sub TryContainsDataMember(myDataSet As DataSet)
   Dim trueorfalse As Boolean
   trueorfalse = Me.BindingContext.Contains(myDataSet, "Suppliers")
   Console.WriteLine(trueorfalse.ToString())
End Sub


[C#] 
private void TryContainsDataMember(DataSet myDataSet){
    bool trueorfalse;
    trueorfalse = this.BindingContext.Contains(myDataSet,"Suppliers");
    Console.WriteLine(trueorfalse.ToString());
 }


[C++] 
private:
     void TryContainsDataMember(DataSet* myDataSet) {
    bool trueorfalse;
    trueorfalse = this->BindingContext->Contains(myDataSet, S"Suppliers");
    Console::WriteLine(trueorfalse);
 }


[JScript] 
private function TryContainsDataMember(myDataSet : DataSet){
    var trueorfalse : bool;
    trueorfalse = this.BindingContext.Contains(myDataSet,"Suppliers");
    Console.WriteLine(trueorfalse.ToString());
 }

See Also

BindingContext Class | BindingContext Members | System.Windows.Forms Namespace

Show: