|
-
Mar 24th, 2002, 07:31 PM
#1
Thread Starter
Fanatic Member
'System.OutOfMemoryException' UGH!
im creating just a simple MDI app and to add a child window i use this code..
Dim NewMDIChild As New Form2()
NewMDIChild.MdiParent = Me
NewMDIChild.Show()
and it worked, but after a bit i got an error
An unhandled exception of type 'System.OutOfMemoryException' occurred in system.windows.forms.dll
Additional information: Error creating window handle.
Now im guessing i am not freeing up my childs after i create and close them, because of the OutOfMemoryException part.
If this is the case, how do i free them when the app closes?
P.S Side question
I would like
Dim NewMDIChild As New Form2()
NewMDIChild.MdiParent = Me
NewMDIChild.Show()
in a module, but if i change the
newmdichild.mdiparent = me to
newmdichild.mdiparent = Form2
it doesnt work, how can i do this?
thanks
-
May 10th, 2004, 08:27 AM
#2
New Member
>P.S Side question
>I would like
>Dim NewMDIChild As New Form2()
>NewMDIChild.MdiParent = Me
>NewMDIChild.Show()
>in a module, but if i change the
>newmdichild.mdiparent = me to
>newmdichild.mdiparent = Form2
>it doesnt work, how can i do this?
>thanks
I recently ran into this problem as well, if you create a Public variable of type Form2 and then in Form2_Load assign a reference to Form2 to that variable, you should be able to access it no problem.
here's what i'm talking about
[in Module1.vb]
Public myForm1 as Form1 'this variable will be accesible to the whole project
[in Form1.vb]
Private Sub Form1_Load(blah, blah blah)
myForm1=me
End Sub
Now whenever you want to access Form1's properties and furthermore the controls contained therein, instead of using Form1 as the variable, use the reference stored in myForm1. I think that should solve your problem.
-
May 10th, 2004, 04:42 PM
#3
Thread Starter
Fanatic Member
Thanks
But this question is two years old
Infact, can't even remember the question. Ohwell useful for archive purposes
-
Jul 10th, 2004, 10:32 AM
#4
Frenzied Member
I'm getting this same exception, with the "error creating window handle" message, and I can't figure out why. This is C#, but the code is easy to read.
When I had this code in the constructor, the MDI child form shows just fine
PHP Code:
Tables t = new Tables(); // Tables is a Windows form
t.MdiParent = this;
t.Show();
But when I put the same exact code in the method that executes when you click a button, I get the OutOfMemoryException
PHP Code:
private void miServerData_Click(object sender, System.EventArgs e)
{
Tables t = new Tables(); // Tables is a Windows form
t.MdiParent = this;
t.Show(); // Error on this line
}
I'm trying to track it down, can anyone help?
Thanks,
Mike
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|