Click here to Skip to main content
15,886,661 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Dear friends

I create an UserControl which has a groupBox and a checkBox in the corner.
The Purpose is to enable/disable the controls in the groupBox when checkBox.Checked changes.

My problem is:

When I add an instance of drag an userControl on a Form, the controls that I add to it, won't place in groupBox.Controls collection.

Please help me friends. I know it doesn't make scene but really it happened.
Posted
Updated 28-Jul-12 13:52pm
v5
Comments
[no name] 28-Jul-12 20:17pm    
Probably because when your user control is on the form the groupbox cannot get brought forward so that controls can be added to it.

1 solution

1 - this makes no sense. NEVER make controls public, expose properties to change the things you want to allow. But, if it's enabled or not has nothing to do with class modifiers

2 - If you add controls on to the groupbox, then they will be inside your control, not inside the form that holds them, surely ?
 
Share this answer
 
Comments
[no name] 28-Jul-12 19:02pm    
Actually it is not an answer.
Christian Graus 28-Jul-12 19:04pm    
To the degree that you asked a question, this is the answer.
[no name] 28-Jul-12 19:54pm    
I just told you my real experiment.
Christian Graus 28-Jul-12 20:04pm    
I am confused. I told you what I reckon is happening. Your user control gets dragged on to the form as one object. Any other control you add to that user control inside a form, gets added to the form, not the user control. therefore it can't be added to the groupbox in the user control, you need to do that to the control, not the form that has the control on it.
[no name] 28-Jul-12 20:18pm    
Did you mean, it is impossible to drag a control and add it to user-control?
There are no possibility at all?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900