473,387 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

TabPage TabControl Question

meh
New to C#...
I have a tab page with a handful of controls on it (label, combobox, etc.).
Is it possible to "boilerplate a tabPage with the controls "like a MDI
childForm" so that adding a new tabPage includes the controls.
Any examples, documentation or comments would be helpful.
tia
meh
Nov 16 '05 #1
5 1996
Hi, meh

You have to use standard inheritance. As control is basically same old class
you can use something like this:

class BaseTabPage {
// here you define tab page and all the controls, which you need to be
present on this page and other pages
}

class NewTabPage : BaseTabPage {
// here you define only controls, which should exist in addition to ones
already defined in BaseTabPage
}

And then you instantiate your new pages with standard new:

NewTabPage tp1=new NewTabPage();

BaseTabPage in this case serves as "boilerplate" one.

I would suggest also to check any books on OO programming in .Net - they
usually are full of similar examples.

HTH
Alex

"meh" <no*************@cox.net> wrote in message
news:eH*************@TK2MSFTNGP10.phx.gbl...
New to C#...
I have a tab page with a handful of controls on it (label, combobox, etc.). Is it possible to "boilerplate a tabPage with the controls "like a MDI
childForm" so that adding a new tabPage includes the controls.
Any examples, documentation or comments would be helpful.
tia
meh

Nov 16 '05 #2
Small correction -

class BaseTabPage : TabPage {
....
}

BaseTabPage should be based on TabPage, right?

HTH
Alex

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:u0**************@TK2MSFTNGP09.phx.gbl...
Hi, meh

You have to use standard inheritance. As control is basically same old class you can use something like this:

class BaseTabPage {
// here you define tab page and all the controls, which you need to be
present on this page and other pages
}

class NewTabPage : BaseTabPage {
// here you define only controls, which should exist in addition to ones already defined in BaseTabPage
}

And then you instantiate your new pages with standard new:

NewTabPage tp1=new NewTabPage();

BaseTabPage in this case serves as "boilerplate" one.

I would suggest also to check any books on OO programming in .Net - they
usually are full of similar examples.

HTH
Alex

"meh" <no*************@cox.net> wrote in message
news:eH*************@TK2MSFTNGP10.phx.gbl...
New to C#...
I have a tab page with a handful of controls on it (label, combobox,

etc.).
Is it possible to "boilerplate a tabPage with the controls "like a MDI
childForm" so that adding a new tabPage includes the controls.
Any examples, documentation or comments would be helpful.
tia
meh


Nov 16 '05 #3
meh
Thx Alex

So I was thinking in the right direction......

One more question. In this case it would be better to basically derive
(inherit?) a tabcontrol and the associated "boilerplate" tabpage into my
project...Correct?

tia
meh

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:uG**************@TK2MSFTNGP12.phx.gbl...
Small correction -

class BaseTabPage : TabPage {
...
}

BaseTabPage should be based on TabPage, right?

HTH
Alex

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:u0**************@TK2MSFTNGP09.phx.gbl...
Hi, meh

You have to use standard inheritance. As control is basically same old

class
you can use something like this:

class BaseTabPage {
// here you define tab page and all the controls, which you need to
be
present on this page and other pages
}

class NewTabPage : BaseTabPage {
// here you define only controls, which should exist in addition to

ones
already defined in BaseTabPage
}

And then you instantiate your new pages with standard new:

NewTabPage tp1=new NewTabPage();

BaseTabPage in this case serves as "boilerplate" one.

I would suggest also to check any books on OO programming in .Net - they
usually are full of similar examples.

HTH
Alex

"meh" <no*************@cox.net> wrote in message
news:eH*************@TK2MSFTNGP10.phx.gbl...
> New to C#...
> I have a tab page with a handful of controls on it (label, combobox,

etc.).
> Is it possible to "boilerplate a tabPage with the controls "like a MDI
> childForm" so that adding a new tabPage includes the controls.
> Any examples, documentation or comments would be helpful.
>
>
> tia
> meh
>
>



Nov 16 '05 #4
Hi, meh

basically - yes and no. Depends on how you plan to use templated controls.
TabControl contains a collection of TabPages. You can create and add new
pages derived from BaseTabPage. Same can be done with whole TabControl.
I am not sure what you want to do, so can't say if this is better or not.
Better than what?

HTH
Alex

"meh" <no*************@cox.net> wrote in message
news:eN***************@TK2MSFTNGP12.phx.gbl...
Thx Alex

So I was thinking in the right direction......

One more question. In this case it would be better to basically derive
(inherit?) a tabcontrol and the associated "boilerplate" tabpage into my
project...Correct?

tia
meh

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:uG**************@TK2MSFTNGP12.phx.gbl...
Small correction -

class BaseTabPage : TabPage {
...
}

BaseTabPage should be based on TabPage, right?

HTH
Alex

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:u0**************@TK2MSFTNGP09.phx.gbl...
Hi, meh

You have to use standard inheritance. As control is basically same old

class
you can use something like this:

class BaseTabPage {
// here you define tab page and all the controls, which you need to
be
present on this page and other pages
}

class NewTabPage : BaseTabPage {
// here you define only controls, which should exist in addition to

ones
already defined in BaseTabPage
}

And then you instantiate your new pages with standard new:

NewTabPage tp1=new NewTabPage();

BaseTabPage in this case serves as "boilerplate" one.

I would suggest also to check any books on OO programming in .Net - they usually are full of similar examples.

HTH
Alex

"meh" <no*************@cox.net> wrote in message
news:eH*************@TK2MSFTNGP10.phx.gbl...
> New to C#...
> I have a tab page with a handful of controls on it (label, combobox,
etc.).
> Is it possible to "boilerplate a tabPage with the controls "like a MDI > childForm" so that adding a new tabPage includes the controls.
> Any examples, documentation or comments would be helpful.
>
>
> tia
> meh
>
>



Nov 16 '05 #5
meh
Thanks again Alex exactaly what I needed to know.
Now let's just see if I can do this.......Thanks again for the guidance

meh

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi, meh

basically - yes and no. Depends on how you plan to use templated controls.
TabControl contains a collection of TabPages. You can create and add new
pages derived from BaseTabPage. Same can be done with whole TabControl.
I am not sure what you want to do, so can't say if this is better or not.
Better than what?

HTH
Alex

"meh" <no*************@cox.net> wrote in message
news:eN***************@TK2MSFTNGP12.phx.gbl...
Thx Alex

So I was thinking in the right direction......

One more question. In this case it would be better to basically derive
(inherit?) a tabcontrol and the associated "boilerplate" tabpage into my
project...Correct?

tia
meh

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:uG**************@TK2MSFTNGP12.phx.gbl...
> Small correction -
>
> class BaseTabPage : TabPage {
> ...
> }
>
> BaseTabPage should be based on TabPage, right?
>
> HTH
> Alex
>
> "AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
> news:u0**************@TK2MSFTNGP09.phx.gbl...
>> Hi, meh
>>
>> You have to use standard inheritance. As control is basically same old
> class
>> you can use something like this:
>>
>> class BaseTabPage {
>> // here you define tab page and all the controls, which you need
>> to
>> be
>> present on this page and other pages
>> }
>>
>> class NewTabPage : BaseTabPage {
>> // here you define only controls, which should exist in addition
>> to
> ones
>> already defined in BaseTabPage
>> }
>>
>> And then you instantiate your new pages with standard new:
>>
>> NewTabPage tp1=new NewTabPage();
>>
>> BaseTabPage in this case serves as "boilerplate" one.
>>
>> I would suggest also to check any books on OO programming in .Net - they >> usually are full of similar examples.
>>
>> HTH
>> Alex
>>
>> "meh" <no*************@cox.net> wrote in message
>> news:eH*************@TK2MSFTNGP10.phx.gbl...
>> > New to C#...
>> > I have a tab page with a handful of controls on it (label, combobox,
>> etc.).
>> > Is it possible to "boilerplate a tabPage with the controls "like a MDI >> > childForm" so that adding a new tabPage includes the controls.
>> > Any examples, documentation or comments would be helpful.
>> >
>> >
>> > tia
>> > meh
>> >
>> >
>>
>>
>
>



Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: TMB333 | last post by:
I've researched as much as I can on the issue, but I've not found any clearly defined statement that acknowledges that the Hide method for a TabPage object just doesn't do what it's supposed to do....
2
by: JG | last post by:
Hi, I have a windows form with a TabControl on it. It has 3 tabpages on it. I have also coded a button that is supposed to 'add' a new tabpage. The code in that clicked event looks like this:...
1
by: RA | last post by:
Hi 1) I want to create a TabPage class in design mode - how do I do it? What type of project should I use? Is it going to be a custom control? 2) I have a TabControl that I would like to add to...
3
by: Cynthia | last post by:
I knew that "Hide" doesn't work with Tabpage if I want to hide it. I should use Remove/Add. But I have some other controls in the tabpage which I don't want to use code to dynamiclly create them....
8
by: touf | last post by:
Hi, I've a tabcontrol that contains many similar tabpages (exactly the same structure with different information), the tabpages number isn't known in the design time it depends of the data. Is...
4
by: Stan Sainte-Rose | last post by:
First, I thank you Herfried. I have 3 tabpages in a tabcontrol. I would like to force the user to stay in the current tabpage until he doesn't correctly fill some textboxes. I know how to...
2
by: GatorBait | last post by:
Hi everyone, I have a tabcontrol on a form that contains 4 tabs. I want to make each tab a seperate form because there is a great deal of code behind each page, and organizationally it was...
2
by: Rex the Strange | last post by:
I suspect the answer to this question is "you can't," but here goes anyway: I have a tabcontrol which contains, of course, various tabpages (added programmatically at runtime, but this is...
6
by: ray well | last post by:
i want a user to be able to change tab pages thru the keyboard, i tried entering the TabPage.text as '&1 Names', "&2 Addresses', etc., so that the user can change pages by type ALT 1, ALT 2, on the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.