Solved

C# - Displaying Subforms

Posted on 2007-04-10
4
1,815 Views
Last Modified: 2009-03-24
Hi guys 'n gals,

Is it possible to have a sub-form in C#? Basically, I am curious if I could attach a small Form inside a larger Form, so the form would be able to drag around inside the larger form. In a way it would be bound to the the larger form.

Any ideas?


Cheers!
0
Comment
Question by:Cyber-Drugs
4 Comments
 
LVL 17

Expert Comment

by:Daniel Reynolds
ID: 18886784
in the properties for the form, set IsMdiContainer = true
0
 
LVL 3

Accepted Solution

by:
RizwanKhalid earned 250 total points
ID: 18887867
1) Create two forms named form1 and form2
2) set from1.IsMdiContainer = true; You can do this in the designer of the form.
3) create a new form2 in some function as form2 frm = new form2();
4) set frm.MdiParent = this; instead of this, you can use the name of form1 whatever it is.

If you want a code snippet of the classes, please ask.
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 250 total points
ID: 18891246
You can have forms as child controls in a parent form, without having to resort to using MDI properties.  

Form2 f = new Form2();
f.TopLevel = false;
f.Parent = this;
f.Show();

Bob
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18913349
Cheers guys!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Greetings C# program 17 126
2 questions 10 29
Please explain the parts of these 2 LINQ expressions 3 55
bound data table problem 2 33
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question