Okay, I have a Listbox that is databound to a field in my Access database. It populates fine when the form starts up. Every item in the name column of the database is displayed in my listbox. I also have a textbox that allows the user to type in a name, and a button to add the name. When this submit button is clicked, it adds the item to the database. This works, too. I have added items and then checked the database, even outside of the program, and the items are added.
My problem is that when I add a name, the listbox does not repopulate with that name added unless I go back to the main menu and then back into the module. I have tried a few ideas to fix this:
Listbox.refresh()
TableAdapter.Fill(me.DataSet.tablename) (Copied from the form_load event that populates it correctly)
Listbox.items.add(txtName.text) (This notifies me that I can not manually add a value to a databound control)
What would be the best way to get this Listbox to refresh when I hit the submit button? Am I going to have to make it an unbound Listbox and write the code to run the query on the database to populate it? Or is there a way to allow it to remain databound and just update? Thanks for any help!
My problem is that when I add a name, the listbox does not repopulate with that name added unless I go back to the main menu and then back into the module. I have tried a few ideas to fix this:
Listbox.refresh()
TableAdapter.Fill(me.DataSet.tablename) (Copied from the form_load event that populates it correctly)
Listbox.items.add(txtName.text) (This notifies me that I can not manually add a value to a databound control)
What would be the best way to get this Listbox to refresh when I hit the submit button? Am I going to have to make it an unbound Listbox and write the code to run the query on the database to populate it? Or is there a way to allow it to remain databound and just update? Thanks for any help!