Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

binding combobox gives "can't create a child list for field Company"

Status
Not open for further replies.

kisslogicgoodbye

Programmer
Mar 19, 2001
18
US
I am trying to populate a combobox from a database. The table name is Company and the fields are CompanyName and Company_ID.

this.comboBoxMMVendorContract.DataSource = dataSet1VendorContractList1;

this.comboBoxMMVendorContract.DisplayMember = "Company.CompanyName";

this.comboBoxMMVendorContract.ValueMember = "Company.Company_ID";

I get the error "Can't create a child list for field Company"
 
It could be because you're trying to bind to the dataset, rather than the data table within the dataset.

Try

this.comboBoxMMVendorContract.DataSource = dataSet1VendorContractList1.Tables(0);


Thats assuming you only have one table within the dataset.

Jack
 
Well, I don't get the error, but my drop box is still empty. How would I print out a error from a dataset if it is filled during initialization?
 
Are you sure its actually filling the datatable with any records?

If you have visual studio, run the project and put a stop on the line where you assign the datasource of the drop down list. Then, in the command window, type

? DataSet1VendorContractList1.Tables(0).Rows.Count

and that will tell you how many items are in that datatable.

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top