Binding.BindingMemberInfo 属性

获取包含有关该绑定的信息的对象(基于 Binding 构造函数中的 dataMember 参数)。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public ReadOnly Property BindingMemberInfo As BindingMemberInfo
用法
Dim instance As Binding
Dim value As BindingMemberInfo

value = instance.BindingMemberInfo
public BindingMemberInfo BindingMemberInfo { get; }
public:
property BindingMemberInfo BindingMemberInfo {
    BindingMemberInfo get ();
}
/** @property */
public BindingMemberInfo get_BindingMemberInfo ()
public function get BindingMemberInfo () : BindingMemberInfo

属性值

一个 BindingMemberInfo,它包含有关该 Binding 的信息。

备注

BindingMemberInfo 通过传递给 Binding 构造函数的 dataMember 字符串创建。

示例

下面的代码示例获取窗体上每个 BindingBindingMemberInfo,并输出 BindingBindingPathBindingFieldBindingMember 属性值。

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
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:
   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()
{
    for (int iCtr1 = 0; iCtr1 < this.get_Controls().get_Count(); iCtr1++) {
        Control thisControl = this.get_Controls().get_Item(iCtr1);
        for (int iCtr2 = 0; 
            iCtr2 < thisControl.get_DataBindings().get_Count(); iCtr2++) {
            Binding thisBinding = 
                thisControl.get_DataBindings().get_Item(iCtr2);

            // Print the control's name and Binding information.
            Console.WriteLine(("\n" + thisControl.ToString()));
            BindingMemberInfo bInfo = thisBinding.get_BindingMemberInfo();
            Console.WriteLine("Binding Path \t" + 
                bInfo.get_BindingPath());
            Console.WriteLine("Binding Field \t" + bInfo.get_BindingField());
            Console.WriteLine("Binding Member \t" + 
                bInfo.get_BindingMember());
        }
    }
} //PrintBindingMemberInfo
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 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

Binding 类
Binding 成员
System.Windows.Forms 命名空间
BindingsCollection