Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
GeneralSys Monitor graphs Pin
Ashwin C13-May-04 11:27
Ashwin C13-May-04 11:27 
GeneralRe: Sys Monitor graphs Pin
Heath Stewart13-May-04 11:49
protectorHeath Stewart13-May-04 11:49 
Generalregistry permissions Pin
elena1234513-May-04 10:36
elena1234513-May-04 10:36 
GeneralRe: registry permissions Pin
Heath Stewart13-May-04 10:56
protectorHeath Stewart13-May-04 10:56 
GeneralRe: registry permissions Pin
elena1234513-May-04 11:31
elena1234513-May-04 11:31 
GeneralRe: registry permissions Pin
Heath Stewart13-May-04 11:35
protectorHeath Stewart13-May-04 11:35 
GeneralRe: registry permissions Pin
Heath Stewart13-May-04 10:59
protectorHeath Stewart13-May-04 10:59 
GeneralMDI Client Pin
Agent 8613-May-04 10:07
Agent 8613-May-04 10:07 
I have created a user control, on which I have place an MDI Client control. I next added my control to a project. Now, I want to open new Forms inside of the Client. Here is my problem:

childForm myChild = new childForm(); //Creating a form to be added to the MdiClient <br />
mdi1.m.Controls.Add(myChild); //mdi1 is the user control, m is the publically accessible MDI Client <br />
<br />
myChild.Show(); //Shows the form <br />

The error occurs here:
<br />
mdi1.m.Controls.Add(myChild); <br />

this is the error:

An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll 

Additional information: Can only add MDI child forms to an MdiClient.

The only way I can currently get around this is to make my main form an MDI Parent, and add this code before adding the form to the user control:
<br />
myChild.MdiParent = this; <br />

Then, when I try to add the form to the user control, it works beautifully. I can only assume that this is because the Form.IsMdiChild property is set to TRUE.
But, I need to do this without first adding it to an MDI Parent (making my main form an MDI Parent.)
So my question is:

1) Is there a way to write to the Form.IsMdiChild value?

or

2) Is there another way to do this?

Hopefully, this problem will interest somebody... Thanks.

Agent 86
GeneralRe: MDI Client Pin
Dave Kreskowiak13-May-04 12:01
mveDave Kreskowiak13-May-04 12:01 
GeneralCreating Dataset Pin
MrJJKoolJ13-May-04 10:06
MrJJKoolJ13-May-04 10:06 
GeneralRe: Creating Dataset Pin
Heath Stewart13-May-04 11:07
protectorHeath Stewart13-May-04 11:07 
GeneralRe: Creating Dataset Pin
MrJJKoolJ13-May-04 11:12
MrJJKoolJ13-May-04 11:12 
GeneralRe: Creating Dataset Pin
Heath Stewart13-May-04 11:21
protectorHeath Stewart13-May-04 11:21 
GeneralSort TreeView items by different logic Pin
Gian13-May-04 5:13
Gian13-May-04 5:13 
GeneralRe: Sort TreeView items by different logic Pin
Heath Stewart13-May-04 8:56
protectorHeath Stewart13-May-04 8:56 
GeneralRe: Sort TreeView items by different logic Pin
Gian16-May-04 22:02
Gian16-May-04 22:02 
GeneralRe: Sort TreeView items by different logic Pin
Heath Stewart17-May-04 3:20
protectorHeath Stewart17-May-04 3:20 
GeneralRe: Sort TreeView items by different logic Pin
Gian17-May-04 4:58
Gian17-May-04 4:58 
GeneralRe: Sort TreeView items by different logic Pin
Heath Stewart17-May-04 5:13
protectorHeath Stewart17-May-04 5:13 
GeneralRe: Sort TreeView items by different logic Pin
Gian17-May-04 5:35
Gian17-May-04 5:35 
GeneralRe: Sort TreeView items by different logic Pin
Heath Stewart17-May-04 6:17
protectorHeath Stewart17-May-04 6:17 
GeneralRe: Sort TreeView items by different logic Pin
Gian17-May-04 23:16
Gian17-May-04 23:16 
GeneralRe: Sort TreeView items by different logic Pin
Heath Stewart18-May-04 3:37
protectorHeath Stewart18-May-04 3:37 
GeneralRe: Sort TreeView items by different logic Pin
Gian19-May-04 5:25
Gian19-May-04 5:25 
Generalhelp with winuser.h Pin
HappyPaws13-May-04 4:28
HappyPaws13-May-04 4:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.