Question Question about Select() method

JA12

Member
Joined
Jul 2, 2013
Messages
17
Location
Ireland
Programming Experience
10+
I'm trying to do something that doesn't seem possible.

All form controls seem to have the .select() method.

There also doesn't seem to be a Selection option

VB.NET:
With Selection

I'll explain what I'm trying to do.

I have a very complicated set of controls that I want to create as on a template form and then repeatedly "copy" at runtime.

I've discovered that if I do

VB.NET:
Dim oGroup As GroupBox  ' or any other container
oGroup = TemplateGroup
oGroup.Controls.Item(0).Name = "Unique_Name"

This changes both the name of the control on the new oGroup and the original control on the TemplateGroup.

So the Copy is not a copy at all, it's a mirror/clone.

This is why I've been diving down the possible Select() option.

Is there a way to take a true Copy of a container and it's controls without mirroring the original?
 
You should be creating a user control. You add one to your project in much the same way as you do a form and you design and code it in much the same way too. Once you build your project, it will appear at the top of your Toolbox and you can then add it to a form or another user control in exactly the same way as you would any other control. You can then add instances of your user control to your form at run time as single units without having to worry about copying anything.
 
Back
Top