5
Answers

how can i add three existing windows form to tab control in Main form

Hi friends,
         I have One main form  and there are some sub forms. I have already created the sub forms independently. In the main form i have menu controls.

For instance Main  form--Managementform
menu control in mainform - Management(main menu)
                     -student(sub menu)
                      -teacher(sub menu)
when i open sub menu student That contain three tab  pages. 1.for student personal registration,2.for student contact registration 3.studemt academic registration.  what i did was  three forms have been  created independently and  data transformed from login page to main page and main form to sub forms. now i want to add this forms to tab pages without loss of the data transfer between pages. because data transfered through form constructor methods. is it possible to do this? if so please tell me how to that.
  

Answers (5)
0
Vulpes

Vulpes

NA 98.3k 1.5m 12y
If you have 3 forms to embed, then changing them to UserControls is probably the best solution.

However, for the record, you can embed a form (as such) by changing its TopLevel property to false before adding it to the container's Controls collection.
0
Sukesh Marla

Sukesh Marla

NA 11.8k 1.2m 12y

Attachment rndw.zip

Yes that what i told bhaskar,
You windows form is dereivied from Form Class, Just change it to UserConrtrol..Thats it

Find attached zip for demo.

Your Response is important to use. Please Check This is Currect Answer, if it helped
0
baskaran chellasamy

baskaran chellasamy

NA 114 119.8k 12y
when added like this the error is top level control cannot be added to a control exception occurs.and how to change windows forms to usercontrol
0
baskaran chellasamy

baskaran chellasamy

NA 114 119.8k 12y
when added like this the error is top level control cannot be added to a control exception occurs.and how to change windows forms to usercontrol
0
Sukesh Marla

Sukesh Marla

NA 11.8k 1.2m 12y
Its simple just do a trick

every window form is derived from Form class, just change it UserControl, no need to change anything else.(do it for all three child forms)
and now u can simply do like follow.

tabControl1.TabPages[0].Controls.Add(new FrmStudent());
tabControl1.TabPages[1].Controls.Add(new FrmTeacher());


Hope It Helped. Please Check This is Currect Answer.