By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 943 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

add item from textbox to listbox during runtime

P: 25
Hi, I have a combobox, textbox, listbox, and a save button. Combobox is filled with illness names stored from database. Every illness that will be selected from the combobox, its symptoms will be listed in the listbox. When a symptom is typed in the textbox and save button is clicked, the selected value from the combobox and the new symptom typed from the textbox will be saved in the database and the newly typed symptom should be added in the listbox..but I can't add the item from textbox to listbox. I already tried lstIllness.Items.Add(textbox1.text) but got an error, it says 'Items collection cannot be modified when the data source property is set'. Please help me. Thanks
Mar 14 '13 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 10K+
P: 12,382
Add the item to the data source instead and then requery the listbox.
Mar 14 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.