BindingMemberInfo.BindingField Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the property name of the data-bound object.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public string BindingField { get; }

Property Value

Type: System.String

The property name of the data-bound object. This can be an empty string ("").

The BindingField is the last item found in the navigation path returned by the BindingMember property. For example, if a new Binding is created that has a dataMember parameter of "Customers.custToOrders.OrderDate", BindingMember will return "OrderDate".

The following code example gets the BindingMemberInfo of each Binding on a form, and prints the BindingPath, BindingField, and BindingMember property values of BindingMemberInfo.

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();
      }   
   }
}

.NET Framework
Available since 1.1
Return to top
Show: