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
vb_newbie 0 Newbie Poster
Recommended Answers
Jump to PostHi,
Dont directly bind to the ListBox control..
Populate items to it, using SQL Reader..
and then you can add listitems, as and when required..Regards
Veena
Jump to PostHi,
Remove Line Number 17.. dont set the dataSource for lstProd
Regards
Veena
All 7 Replies
jassicasim 0 Newbie Poster
QVeen72 104 Posting Shark
HctiMitcH 0 Newbie Poster
vb_newbie 0 Newbie Poster
QVeen72 104 Posting Shark
adam_k 239 Master Poster
vb_newbie 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.