Binding.PropertyName プロパティ
コントロールのデータ連結プロパティの名前を取得または設定します。
Public ReadOnly Property PropertyName As String
[C#]
public string PropertyName {get;}
[C++]
public: __property String* get_PropertyName();
[JScript]
public function get PropertyName() : String;
プロパティ値
バインド先のコントロール プロパティの名前。
解説
PropertyName を使用して、データ ソースのリストにバインドするコントロール プロパティを指定します。通常は、 TextBox コントロールの Text プロパティなどの表示プロパティをバインドします。ただし、コントロールの任意のプロパティをバインドできるため、データベースのデータを使用するコントロールを実行時にプログラムによって作成できます。
使用例
フォーム上の各コントロールについて、それぞれの Binding の 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
End Class
[C#]
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);
}
}
}
[C++]
private:
void PrintPropertyNameAndIsBinding() {
System::Collections::IEnumerator* myEnum = this->Controls->GetEnumerator();
while (myEnum->MoveNext()) {
Control* thisControl = __try_cast<Control*>(myEnum->Current);
System::Collections::IEnumerator* myEnum = thisControl->DataBindings->GetEnumerator();
while (myEnum->MoveNext()) {
Binding* thisBinding = __try_cast<Binding*>(myEnum->Current);
Console::WriteLine(S"\n {0}", thisControl);
// Print the PropertyName value for each binding.
Console::WriteLine(thisBinding->PropertyName);
}
}
}
[JScript]
private function PrintPropertyNameAndIsBinding()
{
for(var thisControl : Control in this.Controls)
{
for(var thisBinding : Binding in thisControl.DataBindings)
{
Console.WriteLine("\n" + thisControl.ToString());
// Print the PropertyName value for each binding.
Console.WriteLine(thisBinding.PropertyName);
}
}
}
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET