简体   繁体   中英

Winforms Combobox and Databinding

I am databinding a combobox to a DataSet, however I want to insert a single item at the top for "None".

Doing:

 combobox.Items.Insert(0,"None");

Doesn't work, as the combobox is now expecting a DataRowView, however DataRowView doesn't have a public constructor, so I can't fake it that way.

Any advice? I'm sure this is a well solved problem.

Insert to the object you are databinding to rather than to the combobox. Good example below.

http://social.msdn.microsoft.com/forums/en-US/winforms/thread/70785e67-5c27-428f-ac79-e45c8c70c3e8/

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM