Click here to Skip to main content
12,953,743 members (53,861 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi every one ,, i want to Load a winForm inside of panel !!!
is that possible ?! Or not ...

you know in we can load web pages together with JQuery


and i want to implimment somthing like that in winapp !!!
Posted 17-Feb-13 4:13am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

First of all, parent-child relationship between form and other controls is intentionally rendered partially defunct: a form can be a parent of a non-form control, not the opposite. This limitation can be removed is you assign false to Form.TopLevel, but — never do it; it makes no sense. The form will be shown inside the panel with all its non-client areas (if any), in all the ugliness. You never really need it.

Instead, you can design your form properly. If you describe what functionality leads you to such weird design ideas, you might get an advice of more adequate design.

The analogy with your jQuery example is incomplete. The control Form is special in this library. In a Web application, the "main form" is the Browser window, which you never "touch".

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Its easy to do so, for example if you want to load form 3 at a panel in form 2 all you have to do is to put a panel with public modifier in form 3 then put all your controls and in form 2 you call the form 3 this way
Form3 f3=new Form3();
f3.panel1.Parent=panel2;        //panel1 is the public panel in form3 and panel2 is the panel in form2 you want to load your form in
Sergey Alexandrovich Kryukov 17-Feb-13 11:58am
This is not a form in panel; this is a panel in panel. A form can be inserted in panel, but not in such a simple way, besides, doing so is useless. Sorry for my vote of 1.
a1mimo 17-Feb-13 12:03pm
I don't mind the vote at all we all learn but this way works and as I said if he put the panel in form as the base of the form this will load his form there you can try it I always use this way, thanks for your comment
Sergey Alexandrovich Kryukov 17-Feb-13 12:07pm
Yes, it works, but please read the question. f3.Parent is null. OP asks for f3.Parent = somePanel. It will throw exception "control is not top-level". Please see my answer where I explain it all.
a1mimo 17-Feb-13 12:14pm
I know what you mean but as you said in your answer this would be useless and the next best solution for him is to do as I mentioned this will give him what he wants in another way, by the way if you have some knowledge in android I have an unanswered question about it please help :-)
Sergey Alexandrovich Kryukov 17-Feb-13 12:37pm
Sorry, the only little problem is: I never had Android in my hands, don't have an idea why would I... :-)

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
ppolymorphe 2,020
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 17 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100