add item from textbox to listbox during runtime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kumsay
    New Member
    • Jan 2013
    • 25

    add item from textbox to listbox during runtime

    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.Item s.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
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Add the item to the data source instead and then requery the listbox.

    Comment

    Working...