Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Class From Existing TabControl?

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
I have a tabcontrol that has 3 tabs on it that display various information with a datagridview control on each tab. I would like to make this a class so I can drop it on a couple of other forms. Can somebody point me in the right direction to create a class from an existing tabcontrol, or do I have to code everything? Can I copy the code from the auto-generated form code to get the process started? Not quite sure where I should start.

Auguy
Sylvania/Toledo Ohio
 

As far as I know, there isn't a way to create a user control from an existing control or set of controls.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Then you are wrong jebenson, You can create usercontrols with existing controls. Either make it as DLL or copy the usercontrol from project to project.
I can explain you more if it is required.

You can create component class also. I am no so familiar with that.
here is an example.


Zameer Abdulla
 
Another way is to export the usercontrol as template
File > Export template > Item Template.
You can then import to any project from as adding a new form a class.

Zameer Abdulla
Visit >> notes of amateur programmer

 
Thanks Zameer, I will check it out.


Auguy
Sylvania/Toledo Ohio
 

Zameer,

Actually, there isn't a way to do what was originally asked. What you are describing is creating a user control from scratch, which is NOT what was asked. If I read the question correctly, Auguy wants to take controls that are already placed on a form and convert those into a user control, complete with the code, etc. Unfortunately, there is no functionality in Visual Studio to do this. What Auguy will have to do it create a new user control, place the required controls and such and recreate the code, probably by copying it. Once that is done, yes Auguy will then have a control that can be copied between projects, etc.




I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Then you care correct.
What I am saying there is no one-click solution for anything. If anybody enjoying some facility then someone in the past had taken the pain to create it.

Now in this situation they can have the functionality by copying everything(any how they have to remove project specific info when it is converted as a template) within very little time

Zameer Abdulla
Visit >> notes of an amateur programmer

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top