locked
Combobox is not updating when row is added to DataTable RRS feed

  • Question

  • I have a combobox that has a bindingsource as a datasource, with a displaymember and valuemember selected.  I have a button which adds a new row to a datatable, and I've verified that my code succesfully adds rows to the DataTable as expected, but the newly added row does not appear in the combobox.  When I perform a dataadapter update, the new rows are written to the database, and the new items appear in the combobox when performing a subsequent dataadapter.fill.  I suspect there is something with databinding that I am missing that is not updating my combobox.  Can someone help?  Thanks!

    Corey

     

    Thursday, August 17, 2006 9:26 PM

Answers

  • that is correct, if you directly add a new row to the dataTable, the datagridview/combobox will not know anything about it, you would have to rebind them using the DataSource property again, instead of calling the update() method of the DataAdapter just to commit and update the changes in the combobox/database

     

    Thursday, August 17, 2006 10:01 PM