G
Guest
Visual Studio 2003 .Net / C#
I have a 2 page Tab Control for users to add a Job in my application. The
first page is for them to choose which type of Job they would like. The type
of Job determines what information is asked for on the second page, and so
will determine the layout of the second page. So this second page needs to
be determined at runtime really when they select the Job Type on page 1. I
thought I could maybe define all the controls (Labels, Buttons, TextBoxes,
ComboBoxes etc) in seperate class file, then when they make their selection
on page 1, I instantiate this class and create the objects on my tabpage.
Is this possible? If so how?
I have a PlumbJob.cs which has in it 2 TextBoxes and 2Labels defined, these
have their appropriate locations, sizes names etc defined in the PlumbJob.cs,
and then I have public ArrayList with this objects in it.
When I select the JobType on TabPage1 I initialize this class, and scroll
through the Controls in this ArrayList, and try and create instances of them
on my TabPage like this:
foreach(Control ctTemplate in PlumbJob.ObjectArray)
{
Control obj = new
Control(tpWizard2,ctTemplate.Text,ctTemplate.Left,ctTemplate.Top,ctTemplate.Width,ctTemplate.Height);
obj.Name = ctTemplate.Name;
obj.Visible = true;
}
but I cant see the objects on my tab page. Any ideas?? Is this a viable way
of doing what I am trying to achieve?
Thanks
I have a 2 page Tab Control for users to add a Job in my application. The
first page is for them to choose which type of Job they would like. The type
of Job determines what information is asked for on the second page, and so
will determine the layout of the second page. So this second page needs to
be determined at runtime really when they select the Job Type on page 1. I
thought I could maybe define all the controls (Labels, Buttons, TextBoxes,
ComboBoxes etc) in seperate class file, then when they make their selection
on page 1, I instantiate this class and create the objects on my tabpage.
Is this possible? If so how?
I have a PlumbJob.cs which has in it 2 TextBoxes and 2Labels defined, these
have their appropriate locations, sizes names etc defined in the PlumbJob.cs,
and then I have public ArrayList with this objects in it.
When I select the JobType on TabPage1 I initialize this class, and scroll
through the Controls in this ArrayList, and try and create instances of them
on my TabPage like this:
foreach(Control ctTemplate in PlumbJob.ObjectArray)
{
Control obj = new
Control(tpWizard2,ctTemplate.Text,ctTemplate.Left,ctTemplate.Top,ctTemplate.Width,ctTemplate.Height);
obj.Name = ctTemplate.Name;
obj.Visible = true;
}
but I cant see the objects on my tab page. Any ideas?? Is this a viable way
of doing what I am trying to achieve?
Thanks