Export (0) Print
Expand All

Binding.BindingMemberInfo Property

Gets an object that contains information about this binding based on the dataMember parameter in the Binding constructor.

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

Property Value

A BindingMemberInfo that contains information about this Binding.

Remarks

The BindingMemberInfo is created from the dataMember string passed to the Binding constructor.

Example

The following example gets the BindingMemberInfo object of each Binding on a form, and prints that Binding object's BindingPath, BindingField, and BindingMember, property value.

[Visual Basic] 
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);
      }
   }
}

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Binding Class | Binding Members | System.Windows.Forms Namespace | BindingsCollection

Show:
© 2014 Microsoft