• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1100
  • Last Modified:

Update/Refresh ComboBox When Record is Added to Database

I have a combobox that is bound to a view in my database via the wizard that shows up as the right arrow on the combobox during design.  I have specified the view and upon the form load event all the records available at that point in time are loaded in the combobox.  I would like to make a refresh button on the form where the user can click it and it will requery the view for any new entries, loading them back into the combobox.  I'm unsure how to accomplish this.
0
cardguy1000
Asked:
cardguy1000
1 Solution
 
rajvjaCommented:
Hi,
  In the button(refresh) click event, call the same procedure which binds the combo.

0
 
srikanthreddyn143Commented:
You have to write seperate func to get the data from database and bind it to the combo box in button click event.
0
 
CodeCruiserCommented:
Would you consider manually populating the combobox, eliminating the wizard code and objects? I can paste the code for that.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
cardguy1000Author Commented:
Sorry for not accepting an answer, I'm just not sastisfied with any of them.  I do know how to manually populate the control and do it that way, but I have a lot of drop downs that I'll be doing this for and the wizard is by far the most efficient way for me.  Is there not a way to refresh the drop down without manually binding data to it?
0
 
CodeCruiserCommented:
No one has asked you to accept an answer yet.
What are the controls being used to populate the dropdown (name of the dataset, datatable, dataadapter etc).
0
 
cardguy1000Author Commented:
I figured it out.  The wizard creates a tableadapter automatically for you, and it also adds a statement to your form load even that is in the format tableadapter.fill(mydataset.table), if you just run this statement again say on the on click event of a refresh button or such, it will refresh the drop down with the latest information from the database.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Tackle projects and never again get stuck behind a technical roadblock.
Join Now