BindingContext.Contains Metoda
Definicja
Pobiera wartość wskazującą BindingContext , czy zawiera określony element BindingManagerBase .Gets a value indicating whether the BindingContext contains the specified BindingManagerBase.
Przeciążenia
Contains(Object) |
Pobiera wartość wskazującą BindingContext , czy zawiera BindingManagerBase skojarzoną z określonym źródłem danych.Gets a value indicating whether the BindingContext contains the BindingManagerBase associated with the specified data source. |
Contains(Object, String) |
Pobiera wartość wskazującą BindingContext , czy zawiera BindingManagerBase skojarzoną z określonym źródłem danych i składową danych.Gets a value indicating whether the BindingContext contains the BindingManagerBase associated with the specified data source and data member. |
Contains(Object)
Pobiera wartość wskazującą BindingContext , czy zawiera BindingManagerBase skojarzoną z określonym źródłem danych.Gets a value indicating whether the BindingContext contains the BindingManagerBase associated with the specified data source.
public:
bool Contains(System::Object ^ dataSource);
public bool Contains (object dataSource);
member this.Contains : obj -> bool
Public Function Contains (dataSource As Object) As Boolean
Parametry
Zwraca
true
Jeśli BindingContext zawiera określony BindingManagerBase ; w przeciwnym razie, false
.true
if the BindingContext contains the specified BindingManagerBase; otherwise, false
.
Przykłady
Poniższy przykład kodu używa metody, Contains Aby określić, czy BindingManagerBase istnieje dla każdej kontrolki w formularzu.The following code example uses the Contains method to determine whether a BindingManagerBase exists for each control on a form. Przykład przekazuje każdy DataTable w oddzielnym DataSet metodzie.The example passes each DataTable in a DataSet to the method.
private:
void TryContains( DataSet^ myDataSet )
{
// Test each DataTable in a DataSet to see if it is bound to a BindingManagerBase.
for each ( DataTable^ thisTable in myDataSet->Tables )
{
Console::WriteLine( "{0}: {1}", thisTable->TableName, this->BindingContext->Contains( thisTable ) );
}
}
private void TryContains(DataSet myDataSet){
// Test each DataTable in a DataSet to see if it is bound to a BindingManagerBase.
foreach(DataTable thisTable in myDataSet.Tables){
Console.WriteLine(thisTable.TableName + ": " + this.BindingContext.Contains(thisTable));
}
}
Private Sub TryContains(myDataSet As DataSet)
Dim thisTable As DataTable
' Test each DataTable in a DataSet to see if it is bound to a BindingManagerBase.
For Each thisTable In myDataSet.Tables
Console.WriteLine(thisTable.TableName & ": " & Me.BindingContext.Contains(thisTable))
Next
End Sub
Uwagi
Zapoznaj się z Binding klasą, aby uzyskać listę możliwych źródeł danych i informacje o tworzeniu powiązań między kontrolkami i źródłami danych.See the Binding class for a list of possible data sources and information about creating bindings between controls and data sources.
Zobacz Item[] Właściwość, aby uzyskać informacje dotyczące zwracania BindingManagerBase tylko źródła danych.See the Item[] property for information about returning a BindingManagerBase using only a data source.
Zobacz też
Dotyczy
Contains(Object, String)
Pobiera wartość wskazującą BindingContext , czy zawiera BindingManagerBase skojarzoną z określonym źródłem danych i składową danych.Gets a value indicating whether the BindingContext contains the BindingManagerBase associated with the specified data source and data member.
public:
bool Contains(System::Object ^ dataSource, System::String ^ dataMember);
public bool Contains (object dataSource, string dataMember);
member this.Contains : obj * string -> bool
Public Function Contains (dataSource As Object, dataMember As String) As Boolean
Parametry
- dataMember
- String
Informacje, które są konieczne do rozpoznania do określonego BindingManagerBase .The information needed to resolve to a specific BindingManagerBase.
Zwraca
true
Jeśli BindingContext zawiera określony BindingManagerBase ; w przeciwnym razie, false
.true
if the BindingContext contains the specified BindingManagerBase; otherwise, false
.
Przykłady
Poniższy przykład kodu używa metody, Contains Aby sprawdzić, czy określony BindingManagerBase istnieje przed podjęciem próby pobrania go za pośrednictwem Item[] właściwości.The following code example uses the Contains method to test whether a specific BindingManagerBase exists before attempting to get it through the Item[] property.
private:
void TryContainsDataMember( DataSet^ myDataSet )
{
bool trueorfalse;
trueorfalse = this->BindingContext->Contains( myDataSet, "Suppliers" );
Console::WriteLine( trueorfalse );
}
private void TryContainsDataMember(DataSet myDataSet){
bool trueorfalse;
trueorfalse = this.BindingContext.Contains(myDataSet,"Suppliers");
Console.WriteLine(trueorfalse.ToString());
}
Private Sub TryContainsDataMember(myDataSet As DataSet)
Dim trueorfalse As Boolean
trueorfalse = Me.BindingContext.Contains(myDataSet, "Suppliers")
Console.WriteLine(trueorfalse.ToString())
End Sub
Uwagi
Zapoznaj się z Binding klasą, aby uzyskać listę możliwych źródeł danych i informacje o tworzeniu powiązań między kontrolkami i źródłami danych.See the Binding class for a list of possible data sources and for information about creating bindings between controls and data sources.
Zapoznaj się z Item[] właściwością, aby uzyskać informacje na temat powrotu BindingManagerBase przy użyciu źródła danych i elementu członkowskiego danych.See the Item[] property for information about returning a BindingManagerBase using a data source and data member.