I am building a user control that has a combo box (comboBoxMain) as a
constutient control. The user control has an Items property, which will set
the items of the combo box. I want the user control Items property to be
browsable at design-time, so the user of the control can click the
properties, enter a list of items in the String Collection Editor and have
them appear in the combo box.

Here's the code I'm using now:

[Browsable(true)]
[EditorBrowsable(EditorBrowsableState.Always)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Editor("System.Windows.Forms.Design.StringCollectionEditor,System.Design",
"System.Drawing.Design.UITypeEditor, System.Drawing")]
[Description("The list of objects in the combo box")]
public ComboBox.ObjectCollection Items
{
get { return comboBoxMain.Items; }
set { comboBoxMain.Items = value; }
}

The Editor attribute brings up the String Collection Editor, but it isn't
retrieving any items I place in the combo box. And nothing that I enter in
the editor is making it back to the combo box.

What do I need to do to complete the connection between the user control
Items property and the combo box Items property? Thanks.

--
David Veeneman
Foresight Systems

Re: Setting combo box items property? by David

David
Wed Apr 05 19:13:50 CDT 2006

For the benefit of others researching this question at a later date, I found
my answer at:

http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_frm/thread/8b2d0c86bc1e6111/49c408655b4bca45?lnk=st&q=StringCollectionEditor&rnum=12&hl=en#49c408655b4bca45

Thanks to Rachel Suddeth for posting the answer to her own question!

--
David Veeneman
Foresight Systems