Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 215
Kaili Avatar asked May 25 '11 22:05

Kaili


2 Answers

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.

like image 54
Teoman Soygul Avatar answered Sep 19 '22 03:09

Teoman Soygul


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.

like image 35
alexD Avatar answered Sep 21 '22 03:09

alexD