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

  • SEARCH
  • Home
  • 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'm trying to use windbg more, and I keep having problems with the symbol
I'm writing a C program but I keep having problems with my array of
I keep having problems deciding how I should create my classes internally. Initially I
I am still having problems with figuring out how to create winforms in a
The problem that I am having has to do with the need to keep
I keep having an error when running my web application. The error does not
I keep hearing that div tags should be used for layout purposes and not
I'm using NET 2.0 with WinForms on C#. I am having a big problem
I'm having problems with this snippet of code: while(scanf(%d,&numOfPlayers)!=1){ printf(Please enter the right number
I'm having problems starting my application. Basically, I have an existing application, but just

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.