Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

BindingMemberInfo.BindingField Property

Gets the data-bound object's property name.

[Visual Basic]
Public ReadOnly Property BindingField As String
[C#]
public string BindingField {get;}
[C++]
public: __property String* get_BindingField();
[JScript]
public function get BindingField() : String;

Property Value

The data-bound object's property name.

Remarks

The BindingField is the last item found in the navigation path returned by the BindingMember property. For example, if the navigation path is "Customers.custToOrders.OrderDate", the BindingField returns "OrderDate" which names the data-bound property of the data source.

Example

[Visual Basic, C#, C++] The following example gets the BindingMemberInfo object of each Binding on a form, and prints the BindingMemberInfo object's BindingPath, BindingField, and BindingMember property values.

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

[C#] 
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();
      }   
   }
}

[C++] 
private:
   void PrintBindingMemberInfo() {
      Console::WriteLine(S"\n BindingMemberInfo");
      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);
            BindingMemberInfo bInfo = thisBinding->BindingMemberInfo;
            Console::WriteLine(S"\t BindingPath: {0}", bInfo.BindingPath);
            Console::WriteLine(S"\t BindingField: {0}", bInfo.BindingField);
            Console::WriteLine(S"\t BindingMember: {0}", bInfo.BindingMember);
            Console::WriteLine();
         }
      }
   }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

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

BindingMemberInfo Structure | BindingMemberInfo Members | System.Windows.Forms Namespace | Binding | BindingPath | BindingMember

Show:
© 2015 Microsoft