Click here to Skip to main content
15,913,361 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all visitors
i have problem with sub form in vb.net. it is different Access that have sub form.
i have 3 forms( 1 is main form,2 is item form,3 item list)
This is my process:
1. item form is inside panel1 of main form
2. form 3(item list) can open when i click buttom on form 2( Item)
3. when display item list also inside panel1 of main form too

how can i make item list inside panel1 of main form?

Best Regards,
TONY
Posted

1 solution

You cannot put one form insider another. There is no functional parent-child relationship between forms.

Formally, a Form is Control, so Control.Parent could be used for Forms, but an attempt to make one form a parent of another one throws an exception. You can do a dirty work-around by using P/Invoked unmanaged Windows API SetParent, but… don't do it. The preventions of putting a form into a form is a good fool-proof measure, don't abuse this .NET UI library.

Instead, make just one form. What were different forms re-work into panels, use Control.Parents.Add. A very good alternative is using TabControl; in this case what were your form will be the TabPages. It's easy to implement and looks and function in a very nice ways.

Good luck,
—SA
 
Share this answer
 
Comments
soeun tony 16-Aug-11 21:12pm    
Thanks for your reply
I'll try to follow you
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900