I want to add an item to the combobox after binding it. for example:
DataSet csuname = new DataSet();
csu.Fill(csuname);
comboBox1.DataSource = csuname.Tables[0];
comboBox1.DisplayMember = "empfname";
comboBox1.Items.Add("all");
but it gets error like
Items collection cannot be modified when the DataSource property is set.
what is the best way to do this?
最好的方法是将该项直接添加到您的数据源csunam.Tables[0]
,我还要假定它必须是一个可观察的集合才能起作用。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.