This documentation is archived and is not being maintained.

BindingMemberInfo.BindingMember Property

Gets the information that is used to specify the data-bound object's property name.

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

Property Value

An empty string (""), a single property name, or a hierarchy of period-delimited property names that resolves to the final data-bound object's property name.

Remarks

A BindingMemberInfo object is created automatically when you call the Binding constructor with a control-property name, data source, and navigation path. The dataMember parameter contains the BindingMember string.

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 | BindingField | BindingPath

Show: