BindingMemberInfo.BindingField 属性

获取数据绑定对象的属性名。

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

语法

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

value = instance.BindingField
public string BindingField { get; }
public:
property String^ BindingField {
    String^ get ();
}
/** @property */
public String get_BindingField ()
public function get BindingField () : String

属性值

数据绑定对象的属性名。这可以是一个空字符串 ("")。

备注

BindingFieldBindingMember 属性返回的导航路径中的最后一项。例如,如果创建了具有 dataMember 参数“Customers.custToOrders.OrderDate”的新 Binding,则 BindingMember 将返回“OrderDate”。

示例

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

Private Sub PrintBindingMemberInfo()
   Console.WriteLine(ControlChars.Cr + " BindingMemberInfo")
   Dim thisControl As Control
   Dim thisBinding As Binding
   For Each thisControl In  Me.Controls    
      For Each thisBinding In  thisControl.DataBindings
         Dim bInfo As BindingMemberInfo =  _
         thisBinding.BindingMemberInfo
         Console.WriteLine(ControlChars.Tab + _
         " BindingPath: "  + bInfo.BindingPath)
         Console.WriteLine(ControlChars.Tab + _
         " BindingField: " + bInfo.BindingField)
         Console.WriteLine(ControlChars.Tab + _
         " BindingMember: "  + bInfo.BindingMember)
         Console.WriteLine()
      Next thisBinding
   Next thisControl
End Sub
private void PrintBindingMemberInfo()
{
   Console.WriteLine("\n BindingMemberInfo");
   foreach(Control thisControl in this.Controls)
   {
      foreach(Binding thisBinding in thisControl.DataBindings)
      {
         BindingMemberInfo bInfo = thisBinding.BindingMemberInfo;
         Console.WriteLine("\t BindingPath: " + bInfo.BindingPath);
         Console.WriteLine("\t BindingField: " + bInfo.BindingField);
         Console.WriteLine("\t BindingMember: " + 
         bInfo.BindingMember);
         Console.WriteLine();
      }   
   }
}
private:
   void PrintBindingMemberInfo()
   {
      Console::WriteLine( "\n BindingMemberInfo" );
      for each ( Control^ thisControl in this->Controls )
      {
         for each ( Binding^ thisBinding in thisControl->DataBindings )
         {
            BindingMemberInfo bInfo = thisBinding->BindingMemberInfo;
            Console::WriteLine( "\t BindingPath: {0}", bInfo.BindingPath );
            Console::WriteLine( "\t BindingField: {0}", bInfo.BindingField );
            Console::WriteLine( "\t BindingMember: {0}", bInfo.BindingMember );
            Console::WriteLine();
         }
      }
   }
private void PrintBindingMemberInfo()
{
    Console.WriteLine("\n BindingMemberInfo");
    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);
            BindingMemberInfo bInfo = thisBinding.get_BindingMemberInfo();
            Console.WriteLine(("\t BindingPath: " 
                + bInfo.get_BindingPath()));
            Console.WriteLine(("\t BindingField: "  
                + bInfo.get_BindingField()));
            Console.WriteLine(("\t BindingMember: "  
                + bInfo.get_BindingMember()));
            Console.WriteLine();
        }
    }
} //PrintBindingMemberInfo

平台

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

请参见

参考

BindingMemberInfo 结构
BindingMemberInfo 成员
System.Windows.Forms 命名空间
Binding 类
BindingPath
BindingMember