Kaili
Kaili

Reputation: 1208

Adding TabControl to Form with Exisiting Controls

In WinForms C# using .Net 2.0 I want to add a TabControl to a Form that has existing controls. Is there a way to move all the controls into a tab control without Visual Studio blowing away all my event handlers the like? Using Visual Studio 2005.

Upvotes: 8

Views: 5237

Answers (2)

Teoman Soygul
Teoman Soygul

Reputation: 25742

Yes, make the form as large as possible and draw a tab control on the right side of the form. Then select all the controls on the left side and drag them on the tab control. Now your event handlers will remain intact and controls will be placed on the tab control nicely.

Upvotes: 8

alexD
alexD

Reputation: 2364

I would select all of the controls on your form, hit Ctrl-X (cut them), put the TabControl on your form and make it as big as you need, then hit Ctrl-V to paste all of the controls into the TabControl. This will maintain the state of all of your controls..you won't lose event handlers or anything.

Upvotes: 2

Related Questions