Binding.BindingMemberInfo プロパティ

Binding コンストラクタの dataMember パラメータに基づいて、バインディングに関する情報を格納しているオブジェクトを取得します。

Public ReadOnly Property BindingMemberInfo As BindingMemberInfo
[C#]
public BindingMemberInfo BindingMemberInfo {get;}
[C++]
public: __property BindingMemberInfo get_BindingMemberInfo();
[JScript]
public function get BindingMemberInfo() : BindingMemberInfo;

プロパティ値

Binding に関する情報を格納している BindingMemberInfo

解説

BindingMemberInfo は、 Binding コンストラクタに渡された dataMember 文字列から作成されます。

使用例

フォーム上の各 BindingBindingMemberInfo オブジェクトを取得し、その Binding オブジェクトの BindingPathBindingFieldBindingMember の各プロパティ値を出力する例を次に示します。

 
Private Sub PrintBindingMemberInfo()
    Dim thisControl As Control
    For Each thisControl In  Me.Controls
        Dim thisBinding As Binding
        For Each thisBinding In  thisControl.DataBindings
            ' Print the control's name and Binding information.
            Console.WriteLine(ControlChars.Cr + thisControl.ToString())
            Dim bInfo As BindingMemberInfo = thisBinding.BindingMemberInfo
            Console.WriteLine("Binding Path " + ControlChars.Tab _
                             + bInfo.BindingPath)
            Console.WriteLine("Binding Field " + ControlChars.Tab _
                             + bInfo.BindingField)
            Console.WriteLine("Binding Member " + ControlChars.Tab _
                             + bInfo.BindingMember)
        Next thisBinding
    Next thisControl
End Sub

[C#] 
private void PrintBindingMemberInfo()
{
   foreach(Control thisControl in this.Controls)
   {
      foreach(Binding thisBinding in thisControl.DataBindings)
      {
         // Print the control's name and Binding information.
         Console.WriteLine("\n" + thisControl.ToString());
         BindingMemberInfo bInfo = thisBinding.BindingMemberInfo;
         Console.WriteLine("Binding Path \t" + bInfo.BindingPath);
         Console.WriteLine("Binding Field \t" + bInfo.BindingField);
         Console.WriteLine("Binding Member \t" + bInfo.BindingMember);
      }
   }
}

[C++] 
private:
    void PrintBindingMemberInfo() {
        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);

                // Print the control's name and Binding information.
                Console::WriteLine(S"\n {0}", thisControl);
                BindingMemberInfo bInfo = thisBinding->BindingMemberInfo;
                Console::WriteLine(S"Binding Path \t {0}", bInfo.BindingPath);
                Console::WriteLine(S"Binding Field \t {0}", bInfo.BindingField);
                Console::WriteLine(S"Binding Member \t {0}", bInfo.BindingMember);
            }
        }
    }

[JScript] 
private function PrintBindingMemberInfo()
{
   for(var i : int = 0; i < this.Controls.Count; i ++)
   {
      for(var j : int = 0; j < this.Controls[i].DataBindings.Count; j++)
      {
         // Print the control's name and Binding information.
         Console.WriteLine("\n" + this.Controls[i].ToString());
         var bInfo : BindingMemberInfo  = this.Controls[i].DataBindings[j].BindingMemberInfo;
         Console.WriteLine("Binding Path \t" + bInfo.BindingPath);
         Console.WriteLine("Binding Field \t" + bInfo.BindingField);
         Console.WriteLine("Binding Member \t" + bInfo.BindingMember);
      }
   }
}

必要条件

プラットフォーム: 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

参照

Binding クラス | Binding メンバ | System.Windows.Forms 名前空間 | BindingsCollection