Adding a blank row to top of ComboBox

  • Thread starter Thread starter Jay Douglas
  • Start date Start date
J

Jay Douglas

I'm binding an IList to a WinForm combox box DataSource
(ComboxBox.DataSource = myList) and am unable to add a blank row to the top
of the combox. I want users to have the option to not select a value.

I've tried the following things:

myBox.Items.Insert(0, null);

((IList)myBox.DataSource).Insert(0, null)

Both of these attempts have been greeted by exceptions. Please let me know
if you know of any way to solve my problem.

Thanks,
Jay
 
Add the item to your IList. If you set its ID to something
you recognize as not selected or perhaps have a property
on the class to designate the same, you are in business.
 
Back
Top