I would like to create a class that includes a group box and several checkboxs. I want it so when you create a new instance of the class it creates the groupbox and the checkboxs, I do not want to have simply refrence an exsiting groupbox, ect.
I have no Idea how I would go about the creating the groupbox and checkboxs so they would appear on the form through a class. Any help would be much appreciated, thank you in advance.

Creating a Class with multible controls
ukgam3r
Hi,
You probably need to create a new user control and then add your controls onto it. Later you can drag this control on the form like any other control.
If this is not what you're after, here is a second idea:
public static class ControlLoader{
public static void AddControls(Form parentForm)
{
GroupBox groupBox = new GroupBox();
// set additional properties
parentForm.Controls.Add(groupBox);
CheckBox chechBox = new CheckBox();
// set additional properties
parentForm.Controls.Add(chechBox);
}
}
When you call this static method AddControls() of this class, you pass the reference of the form you want to put your controls on. Modify the code to include wanted control positions and sizes.
Hope this helps,
Andrej
Yarrakid
Rather than create a new project for your control simply add a new item to your existing project and when prompted choose a user control.
After that you'll still need to build the project to have it show up in your toolbox but the rest of the tutorial will still help you in actually constructing the user control itself.
TheMaj0r
dfgdrf
Hey, thanks loads both of you, you actually anwsered another question I was about to ask too in a new thread.
Also, Do you know where i can get the control template it is not currently avalible in my new projects screen.
ElroyDSilva