N
Neo
Hi,
I have a Windows Forms app written in vb.NET. I have 2 controls and a form
in the solution, one control (say control1) is used in another control (say
control2) and control2 is placed on a form. I am aware of how to make
control2 a container so that other controls can be placed on it in the IDE
(code below).
I would like to know how I can make control1 the container, so when control2
is placed on a form and a control is added to it, the control is added to
the container being control1 not control2. (hope this makes sense!)
I have tried making control1 a container and this hasn't worked, also I have
tried making control2 the container and when a control is added catching the
event and trying to add the control that was placed on control2 to control1
through code and there are issues there to.
I have seen several controls that must have to do this in some way.
Control2 currently has the following attribute and imports to make the IDE
aware this is a container:
Imports System.ComponentModel
Imports System.ComponentModel.Design
<DesignerAttribute(GetType(System.windows.forms.design.ParentControlDesigner
))> _
and then override the OnControlAdded event and add the following to bring
the added control to the front:
MyBase.OnControlAdded(e)
e.Control.BringToFront()
Any help is great, thanks.
I have a Windows Forms app written in vb.NET. I have 2 controls and a form
in the solution, one control (say control1) is used in another control (say
control2) and control2 is placed on a form. I am aware of how to make
control2 a container so that other controls can be placed on it in the IDE
(code below).
I would like to know how I can make control1 the container, so when control2
is placed on a form and a control is added to it, the control is added to
the container being control1 not control2. (hope this makes sense!)
I have tried making control1 a container and this hasn't worked, also I have
tried making control2 the container and when a control is added catching the
event and trying to add the control that was placed on control2 to control1
through code and there are issues there to.
I have seen several controls that must have to do this in some way.
Control2 currently has the following attribute and imports to make the IDE
aware this is a container:
Imports System.ComponentModel
Imports System.ComponentModel.Design
<DesignerAttribute(GetType(System.windows.forms.design.ParentControlDesigner
))> _
and then override the OnControlAdded event and add the following to bring
the added control to the front:
MyBase.OnControlAdded(e)
e.Control.BringToFront()
Any help is great, thanks.