Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / April 2006

Tip: Looking for answers? Try searching our database.

Setting combo box items property?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Veeneman - 05 Apr 2006 20:07 GMT
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.

Signature

David Veeneman
Foresight Systems

David Veeneman - 06 Apr 2006 01:13 GMT
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_f
rm/thread/8b2d0c86bc1e6111/49c408655b4bca45?lnk=st&q=StringCollectionEditor&rnum
=12&hl=en#49c408655b4bca45


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

Signature

David Veeneman
Foresight Systems


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.