I’m trying to remove selected item from ComboBox Collection:
I wrote a buttonClick:
cb01.Items.Remove(cb01.SelectedItem);.
This deletes the item, but next time I open the Form – the item appears again.
Please help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Add
KeyDownevent for your ComboBox and thenAbove will remove items from comboBox but if you add items on designed time when you load the application again you can see all the items again.
check your
InitializeComponent()method. you can see something like below.when you load the application again, it will call
InitializeComponentand call above method to add items.To avoid this issue. You can use bound data source. e.g you can take items from database. and when you delete you can delete it from database. next time you load the application it only show the items in the database.