Results 1 to 2 of 2

Thread: binding a ds to a text box control [* Resolved *]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Resolved binding a ds to a text box control [* Resolved *]

    Hello

    I am having a lot of trouble with binding a ds to a text box control.

    I have a query SELECT Name, Address, PostCode FROM Customer

    This query fills the dataset. This works fine as l have tested this in my web service. The xml displays the name, address, and postcode.

    But l get my error message when l try and bind this to the text box control. I have tried many things and l now that the syntax is right. Am l missing something.

    //Error Message - Cannot create a child list for field Customer
    txtName.DataBindings.Add("Text",ds,"Customer.Name");
    txtAddress.DataBindings.Add("Text",ds,"Customer.Address");
    txtPostcode.DataBindings.Add("Text",ds,"Customer.PostCode");

    many thanks in advance,

    Steve
    Last edited by steve_rm; Dec 8th, 2005 at 12:43 AM.
    steve

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Re: binding a ds to a text box control

    The problem has been solved. This is what i did?

    Code:
    txtName.DataBindings.Add(new Binding("Text",ds.Tables[0],"Name");
    Another question. Why do l need ds.Tables[0]. I know that the index point to the first table. And the dataset has only been filled with one table "customer".

    I tried this but this method, but did not work.
    Code:
    txtName.DataBinding.Add(new Binding("Text",ds.Tables["Customer"],"Name");
    Can you explain why ds.Tables["customer"] does not work?

    Thanks in advance,

    Steve
    steve

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width