none
cannot bind to the property or column

    Question

  • I've error messge when form is loading

    Cannot bind to the property or column invoiceNumber on the datasource. Parameter name datamember.

    This is the relevant code:

    public frmInvoice()
       {
         InitializeComponent();
         invoiceNumberTextBox.DataBindings.Add("Text", valinor, "invoiceNumber");
       }
    What is the problem?


    Tuesday, October 30, 2012 1:54 PM

Answers

  • Hi Akoss;

    It is a EF ObjectContext / DbContext as shown in your last post. In the below line of code change TABLENAME to the name of the table that the column invoiceNumber is in.

    invoiceNumberTextBox.DataBindings.Add("Text", valinor.TABLENAME, "invoiceNumber");

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Ákoss Wednesday, October 31, 2012 7:14 AM
    Tuesday, October 30, 2012 3:28 PM

All replies

  •  

    What type of object is "valinor" and what is its schema?

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Tuesday, October 30, 2012 2:46 PM
  • It's an entity object:

    ValinorEntities valinor = new ValinorEntities();

    Tuesday, October 30, 2012 2:49 PM
  • Hi Akoss;

    It is a EF ObjectContext / DbContext as shown in your last post. In the below line of code change TABLENAME to the name of the table that the column invoiceNumber is in.

    invoiceNumberTextBox.DataBindings.Add("Text", valinor.TABLENAME, "invoiceNumber");

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Ákoss Wednesday, October 31, 2012 7:14 AM
    Tuesday, October 30, 2012 3:28 PM
  • But it's working well, I don't understand what is a different in my two forms.

    In the first form to bindings is working through property windows.

    In the second form is need to binding through to code, e.g.:

    invoiceNumberTextBox.DataBindings.Add("Text", valinor.TABLENAME, "invoiceNumber");

    Why is that?

    Saturday, November 03, 2012 8:43 PM
  • Can you post an image of the property window showing the binding. 

    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Saturday, November 03, 2012 9:21 PM
  • Monday, November 05, 2012 6:50 AM

  • To your statement, "In the first form to bindings is working through property windows.", If you look at the image you posted you are doing the binding through a BindingSource called partnersBindingSource which directly connects to the valinor object which gives you direct access to its properties.

    To your statement, "In the second form is need to binding through to code,", Why, as long as you have access to the datasource valinor in the second form you should be able to do the same as in the first form.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Monday, November 05, 2012 1:45 PM