Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hi every one ,, i want to Load a winForm inside of panel !!!
is that possible ?! Or not ...
 
you know in asp.net we can load web pages together with JQuery
like
 
$("#Container").load("/SomeDirectory/A.aspx");
and i want to implimment somthing like that in winapp !!!
Posted 17-Feb-13 5:13am
mahmii273
Rate this: bad
good
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".
 
—SA
  Permalink  
Rate this: bad
good
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
f3.Show();
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 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.
—SA
a1mimo at 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 at 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.
—SA
a1mimo at 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 at 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... :-)
—SA

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

  Print Answers RSS
0 Dnyaneshwar@Pune 719
1 CHill60 315
2 Sergey Alexandrovich Kryukov 240
3 TheRealSteveJudge 190
4 Peter Leow 160
0 Sergey Alexandrovich Kryukov 9,193
1 OriginalGriff 6,786
2 Peter Leow 4,332
3 Zoltán Zörgő 3,809
4 Richard MacCutchan 2,672


Advertise | Privacy | Mobile
Web03 | 2.8.150128.1 | Last Updated 17 Feb 2013
Copyright © CodeProject, 1999-2015
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