Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6255611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:23:50+00:00 2026-05-24T14:23:50+00:00

I keep having problems with Winforms data-binding, more specifically, whenever I specify a period-separated

  • 0

I keep having problems with Winforms data-binding, more specifically, whenever I specify a period-separated property path to be used as DataMember. For example:

public partial class SomeForm : System.Windows.Forms.Form
{
    public SomeForm(Book bookToBeDisplayed)
    {
        InitializeComponent();

        authorLabel.DataBindings.Add("Text", bookToBeDisplayed, "Author.Name");  
                                          // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                          //    I cannot get this to work.
    }
}


public class Book : INotifyPropertyChanged
{
    public Person Author { … }
    …
}

public class Person : INotifyPropertyChanged
{
    public string Name { … }
    …
}

The line where I’m adding a binding between authorLabel.Text and bookToBeDisplayed.Author.Name throws the following exception:

ArgumentException: Cannot bind to the property or column Name on the DataSource.

The “Remarks” section of the MSDN page about System.Windows.Forms.Binding explains that period-separated navigation paths can be used as DataMember:

You can also use a period-delimited navigation path when you bind to an object whose properties return references to other objects (such as a class with properties that return other class objects).

What do I have to do to make the above example work?

  • I’ve already made sure that the Book instance passed to SomeForm‘s constructor is properly initialized, and that there are no null references.
  • I also don’t want to resort to DataSets.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:23:52+00:00Added an answer on May 24, 2026 at 2:23 pm

    I found a solution. Apparently, the DataSource must not be a single object, but a collection:

    authorLabel.DataBindings.Add("Text",
                                 new Book[] { bookToBeDisplayed },  // <--
                                 "Author.Name");
    

    The section “Types of Data Binding” of the MSDN page “Data Binding and Windows Forms” mentions that there are two types of data bindings: “simple” and “complex” ones. The latter binding type is also called “list-based binding”. It seems that navigation paths are only supported with the latter binding type.

    P.S.: MSDN also recommends using BindingList<T>, though that’s probably not necessary here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am still having problems with figuring out how to create winforms in a
I keep having problems deciding how I should create my classes internally. Initially I
I'm writing a C program but I keep having problems with my array of
The problem that I am having has to do with the need to keep
I keep hearing that div tags should be used for layout purposes and not
This probably applies to other places, but in WinForms, when I use binding I
I am having problems consuming a WCF web service (PaySimple's v3.00 API) using php
I'm just getting to grips with IIS7 redirect and having problems doing something that
Using Installshield 2011, we're creating a major upgrade and having problems upgrading software with
Does anyone have some good resources on learning more advanced regular expressions I keep

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.