Controlcontainer is .Net

G

Guest

I’m currently familiarizing myself with VB.net and right now I’m looking at
the usercontrol. In VB6 it was possible for a usercontrol to act as a control
container. However, I can’t find a property in .Net that would make it work
similarly. When I look in the MSDN database, all I can find are documents
relating to VB6.
Please tell me a control container is still possible in .Net
 
P

Phill. W

Jerry said:
In VB6 it was possible for a usercontrol to act as a control container.
However, I can't find a property in .Net that would make it work
similarly. When I look in the MSDN database, all I can find are documents
relating to VB6.
Please tell me a control container is still possible in .Net

So you want to write a UserControl and then have other Controls
placed "onto" or "into" the finished article?

Look at the Modifiers on the UserControl and the other Controls
within it. By default, these are Friend, so you can only change them
within your UserControl's assembly. Change them to something more
useful, like Protected (for Developers to use) or Public (for end users).

HTH,
Phill W.
 
G

Guest

Hi Phil,

What I was looking for is basically a combination of a .Net usercontrol and
a .Net panel control. Using the modifiers would give you access to controls
that are placed on the usercontrol itself and not enable you to add controls
to the usercontrol after the usercontrol has been placed on a form, right?

My question has become a bit irrelevant, though. I was a bit stuck in VB6
thinking and forgot about a bonus that .Net has. With inheritance I can
basically do that what I wanted to use the contained controls for. It will
mean more usercontrols in my project, but the forms will be cleaner.

Thanks,

Jerry
 
P

Phill. W

Jerry said:
What I was looking for is basically a combination of a .Net
usercontrol and a .Net panel control.

You could just create your own Control /directly/ derived from Panel,
if you wanted to.
Using the modifiers would give you access to controls that are placed
on the usercontrol itself and not enable you to add controls to the
usercontrol after the usercontrol has been placed on a form, right?

Depends how you set them. IIRC, you can create a UserControl with
a Panel on it (that fills all of the available area), set all the modifies
to
Public and you should be able to drop new Controls onto it, even at
RunTime. I think.
 

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