Binding.BindingMemberInfo Binding.BindingMemberInfo Binding.BindingMemberInfo Binding.BindingMemberInfo Property

定义

获取包含有关该绑定的信息的对象(基于 Binding 构造函数中的 dataMember 参数)。Gets an object that contains information about this binding based on the dataMember parameter in the Binding constructor.

public:
 property System::Windows::Forms::BindingMemberInfo BindingMemberInfo { System::Windows::Forms::BindingMemberInfo get(); };
public System.Windows.Forms.BindingMemberInfo BindingMemberInfo { get; }
member this.BindingMemberInfo : System.Windows.Forms.BindingMemberInfo
Public ReadOnly Property BindingMemberInfo As BindingMemberInfo

属性值

一个 BindingMemberInfo,它包含有关该 Binding 的信息。A BindingMemberInfo that contains information about this Binding.

示例

下面的代码示例获取BindingMemberInfo BindingPath窗体上Binding每个的, 并打印该BindingBindingField、和BindingMember属性值。The following code example gets the BindingMemberInfo of each Binding on a form, and prints the BindingPath, BindingField, and BindingMember property values for that Binding.

private:
   void PrintBindingMemberInfo()
   {
      for each ( Control^ thisControl in this->Controls)
      {
         for each ( Binding^ thisBinding in thisControl->DataBindings)
         {
            // Print the control's name and Binding information.
            Console::WriteLine( "\n {0}", thisControl );
            BindingMemberInfo bInfo = thisBinding->BindingMemberInfo;
            Console::WriteLine( "Binding Path \t {0}", bInfo.BindingPath );
            Console::WriteLine( "Binding Field \t {0}", bInfo.BindingField );
            Console::WriteLine( "Binding Member \t {0}", bInfo.BindingMember );
         }
      }
   }
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);
      }
   }
}
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

注解

BindingMemberInfo 从传递Binding给构造函数的字符串创建的。dataMemberThe BindingMemberInfo is created from the dataMember string passed to the Binding constructor.

适用于

另请参阅