Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Refresh databound Combobox
 

Refresh databound Combobox

I have a typed dataset with a customers table. here is some code for reference

Private custTA As New MyDS.CustomersTableAdapter
cbxCustomers.DataSource = custTA.GetData()
cbxCustomers.DisplayMember = "CustName"
cbxCustomers.ValueMember = "CustID"

I insert a new customer by calling a stored procedure.
custTA.InsertCustomer( "Name","Address")

Whats the best way to refresh the combobox which is bound to the table?






sdoc  Friday, July 06, 2007 4:07 PM

Dear sdoc,

Code:

custTa.Clear();

custTA.InsertCustomer( "Name","Address")
custTa.Refresh();

HTH,

Suprotim Agarwal

Suprotim Agarwal  Friday, July 06, 2007 4:39 PM
there is not Refresh method available on the tableadapter.

sdoc  Monday, July 09, 2007 2:38 PM

Dear sdoc,

That was a typo.

The refresh was for the combo. Try the following code :

cbxCustomers.Clear();

cbxCustomers.DataSource = custTA.GetData();
cbxCustomers.DisplayMember = "CustName";
cbxCustomers.ValueMember = "CustID";

cbxCustomers.Refresh();

HTH,

Suprotim

Suprotim Agarwal  Tuesday, July 10, 2007 3:28 AM

You can use google to search for other answers

Custom Search

More Threads

• Issues Binding DataGridViewComboBoxCell to a Collection or CollectionBase
• null value for databound lookup combo
• Duplicate files created when generating dataset
• Advice needed on best practices approach using dataset/BindingSource
• Bug of DataGrid (multiple deleting)
• How to update data grid if its datasource is more than one table?
• DataGridView
• DataGridView with BindingSource
• TableAdapters Need A Common Interface and Public Adapters and Commands
• Data Grid View is not updating SUM