Reputation: 557
I am Developing project the min Form is Parent to the other Forms ( MDI Application ) the all Child Forms in the running time are working ,, but when i click on the button that open the sales Form ,, the Project is Break down and give me this Error
Error creating window handle. Out of Memory Exception was unhandled
i am using Visual Studio 2008 and Develop using C# 3.5
Upvotes: 0
Views: 3134
Reputation: 1146
There may be an infinite loop during instantiation or loading of your sales form. To find the problem, make a backup of your form and then start removing stuff from it until it doesn't throw OutOfMemoryException anymore.
Upvotes: 0
Reputation: 941337
You are leaking window handles. Run TaskMgr.exe, Processes tab. View + Select Columns, tick USER objects. Watch that column for your process. You'll see it climbing up while you use the program, it bombs when the number reaches 10000.
This happens when you don't call Dispose() on controls that you remove in your code. Either with Controls.Clear or Controls.Remove.
Upvotes: 3
Reputation: 508
Use a try catch when creating the window handle, and catch the exception and handle it accordingly, it might be anomalous that it's throwing an Out Of Memory at that point though?
Upvotes: -1