User control with two panels

M

Mickel Kurtis

Hello, I need to create an user control with two Panels, and allow to insert
other controls in design time.
Im using VB 9 (VS 2008), I found code to allow the insert of controls to the
user control, but the inserts are in the control as
a container, and not the panels, I need the panels to be the containers.

<Designer("System.Windows.Forms.Design.ParentControlDesigner,
System.Design", _
GetType(IDesigner)), DefaultEvent("Click"),
DefaultProperty("Text")> _
Public Class GcCt_expander
'CODE
End Class


I need something like this code, but that allows to insert controls to each
of the panels
that the User control has.

Thank you all!
 
C

cfps.Christian

It may not be the most dynamic or efficient way but I would put a
method on the user control like:

public sub AddControlToPanel1(byval Ctrl as Control)
me.pnl1.controls.add(ctrl)
end sub

public sub AddControlToPanel2(byval Ctrl as Control)
me.pnl2.controls.add(ctrl)
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top