Binding.PropertyName Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the name of the control's data-bound property.
public:
property System::String ^ PropertyName { System::String ^ get(); };
public string PropertyName { get; }
member this.PropertyName : string
Public ReadOnly Property PropertyName As String
The name of a control property to bind to.
The following code example prints the PropertyName value of each Binding for each control on a form.
private:
void PrintPropertyNameAndIsBinding()
{
for each ( Control^ thisControl in this->Controls)
{
for each ( Binding^ thisBinding in thisControl->DataBindings )
{
Console::WriteLine( "\n {0}", thisControl );
// Print the PropertyName value for each binding.
Console::WriteLine( thisBinding->PropertyName );
}
}
}
private void PrintPropertyNameAndIsBinding()
{
foreach(Control thisControl in this.Controls)
{
foreach(Binding thisBinding in thisControl.DataBindings)
{
Console.WriteLine("\n" + thisControl.ToString());
// Print the PropertyName value for each binding.
Console.WriteLine(thisBinding.PropertyName);
}
}
}
Private Sub PrintPropertyNameAndIsBinding
Dim thisControl As Control
Dim thisBinding As Binding
For Each thisControl In Me.Controls
For Each thisBinding In thisControl.DataBindings
Console.WriteLine(ControlChars.CrLf & thisControl.ToString)
' Print the PropertyName value for each binding.
Console.WriteLine(thisBinding.PropertyName)
Next
Next
End Sub
Use the PropertyName to specify the control property that you want to bind to a list in a data source. Most commonly, you bind a display property such as the Text property of a TextBox control. However, because you can bind any property of a control, you can programmatically create controls at run time using data from a database.
Produk | Versi |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET maklum balas
.NET ialah projek sumber terbuka. Pilih pautan untuk memberikan maklum balas: