Design Error: Cannot bind to the property or column "Column Name" on the DataSource. Parameter name: dataMember


  • The following error occurs during design in Visual Studio. Although The binding works fine at runtime.

    Its a problem because I am unable to see the form in visual studio, Just the "To prevent possible data loss...."

    this is the binding placed in the _Load event
    this.LastNameLabel.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeeBindingSource, "LastName"));

    Am I doing something wrong here?         

    I must mention again the binding does work fine during runtime.

    Wednesday, February 24, 2010 9:20 PM

All replies

  • Everything look fine, just try to add true at the end.

    the reason why you get that ist because you add a new bind. remember that the bind need a data source.

    this.LastNameLabel.DataBindings.Add("Text", this.employeeBindingSource, "LastName", true);

    Just Be Humble Malange!
    Wednesday, February 24, 2010 10:28 PM
  • The Load event doesn't run in design.
    Thursday, February 25, 2010 12:32 AM
  • I know the load event will not run in design.

    The error is a problem in design because it prevents me from working within the User Control. The User control design are is replaced with a red boarder and the error is displayed.

    So I can't do anything in designer.


    I added true to the end, still throws an error on designer.

    Once again debug and run works fine.
    Thursday, February 25, 2010 9:42 PM
  • I know the load event will not run in design.
    Then you know your problem doesn't lie in the binding you placed in the Load event handler.
    Friday, February 26, 2010 2:14 AM
  • Hi _Rin,

    Do you have a property or column named "LastName" at design time ?  Do you create your DataSource at runtime but use the property name or column name of the DataSource at design time?

    Best regards,
    Alex Liang

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, February 26, 2010 7:09 AM
  • Alex,

    Both the datasource and the binding were created in design. I override them during the _load

    The label, binding and column all exist during design.

    I am getting a handful of errors similar to this over the last couple days.

    I am using Visual Studio 2010 beta. I starting to wonder if that is the problem.

    Thank you for you input.
    • Proposed as answer by antoinemekary Friday, April 08, 2011 6:34 PM
    Friday, February 26, 2010 3:26 PM