ControlBindingsCollection.Item[String] Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt de opgegeven door de Binding naam van de eigenschap van het besturingselement.
public:
property System::Windows::Forms::Binding ^ default[System::String ^] { System::Windows::Forms::Binding ^ get(System::String ^ propertyName); };
public System.Windows.Forms.Binding this[string propertyName] { get; }
public System.Windows.Forms.Binding? this[string propertyName] { get; }
member this.Item(string) : System.Windows.Forms.Binding
Default Public ReadOnly Property Item(propertyName As String) As Binding
Parameters
- propertyName
- String
De naam van de eigenschap op het gegevensgebonden besturingselement.
Waarde van eigenschap
De Binding eigenschap waarmee de opgegeven besturingselementeigenschap wordt gekoppeld aan een gegevensbron.
Voorbeelden
Het volgende codevoorbeeld retourneert één Binding van een ControlBindingsCollection.
void PrintValue()
{
ControlBindingsCollection^ myControlBindings;
myControlBindings = textBox1->DataBindings;
// Get the Binding for the Text property.
Binding^ myBinding = myControlBindings[ "Text" ];
// Assuming the data source is a DataTable.
DataRowView^ drv;
drv = dynamic_cast<DataRowView^>(myBinding->BindingManagerBase->Current);
// Assuming a column named S"custName" exists, print the value.
Console::WriteLine( drv[ "custName" ] );
}
private void PrintValue()
{
ControlBindingsCollection myControlBindings;
myControlBindings = textBox1.DataBindings;
// Get the Binding for the Text property.
Binding myBinding = myControlBindings["Text"];
// Assuming the data source is a DataTable.
DataRowView drv;
drv = (DataRowView) myBinding.BindingManagerBase.Current;
// Assuming a column named "custName" exists, print the value.
Console.WriteLine(drv["custName"]);
}
Private Sub PrintValue()
Dim myControlBindings As ControlBindingsCollection = _
textBox1.DataBindings
' Get the Binding for the Text property.
Dim myBinding As Binding = myControlBindings("Text")
' Assuming the data source is a DataTable.
Dim drv As DataRowView = _
CType( myBinding.BindingManagerBase.Current, DataRowView)
' Assuming a column named "custName" exists, print the value.
Console.WriteLine(drv("custName"))
End Sub
Opmerkingen
Als de opgegeven eigenschap niet overeenkomt met een binding in de verzameling, Item[] wordt deze geretourneerd null.