urgent custom control with collection of controls at design time

dd_smith

Member
Joined
Dec 16, 2004
Messages
5
Programming Experience
10+
I am interested in someone providing a sample that has a panel on a user control that contains a collection of controls available at design time. To put it simply I would like the following.

1. a user control
2. a panel control
3. a collection of, let's say, label controls that are accessible at design time that are contained on the panel

I understand the method to add a collection, or any control, to the properties window is <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>. What I don't understand is 1. How to create the collection of controls and where to place the <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>. 2. How to place the controls on the Panel at design time.

BTW, I haven't found this simple example on any of the forums. I think Microsoft should provide a decent example of this.
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
@ design time, double click a panel control (it'll stick one on the form) and you can move it & resize it, then with that still highlighted double click on labels, textboxes you name it, and the editor will add them inside the panel (this is also true for groupboxes) and to move existing items from the form into a groupbox or panel simply drag the control and drop it on the panel or groupbox and the editor will move it inside the new container, same goes for moveing items out of the panel and groupbox too
 

dd_smith

Member
Joined
Dec 16, 2004
Messages
5
Programming Experience
10+
You misunderstand what I need. I need a user control containing a panel with a collection of controls where the user control has the collection exposed in it's property window when it is dropped on a form. This will be much like the grid control, which has a columns property in it's property window. When the user clicks on the ellipse '...' an editor pops up where you can add and remove columns and set their properties.
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
ahh, i get what your saying, and well good luck with that
 

dd_smith

Member
Joined
Dec 16, 2004
Messages
5
Programming Experience
10+
TPM
Thanks for your help. It's close, but not quite. I need a collection to show in the property window. Then when I click the ellipse it brings up the editor for adding and removing controls and setting their properties.
 

dd_smith

Member
Joined
Dec 16, 2004
Messages
5
Programming Experience
10+
OK, I was able to build the collection without help. Is there anyone that would care to tackle this problem? The code follows. The collections of buttons, labels, and textboxes are now exposed in the property window for the Usercontrol, code in the attached files. The problem is, when I add a control to the collection it is not apperant where it is placed. It shows up in code for the form in the Windows Generated Code section, but I can't locate it on the form or the Usercontrol.

The code is attached.
 

Attachments

Last edited:

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
dang son! for future reference please use the [ code ] and [ /code ] brackets it's too hard ta read it without the blue background when it comes to code plus the sheer screen size it takes up.
 

hamadeu

New member
Joined
Jul 28, 2005
Messages
1
Location
Brazil, São Paulo
Programming Experience
1-3
Hi dd_smith, I would like to know if you got to solve this problem, because I am with the same problem. I can't make the controls inserted in a property (type collection) to appear in my UserControl. thanks a lot.
 
Top Bottom