Error creating window handle

I faced this problem during a search screen. When I got the record in my GridView and click on a link I am opening a window form. The problem arise when I open 15 to 16 times the window.

Problem:The error is because windows has a limit of 1000 windows handles so I presume data grid returns more than 1000 or near enough rows. We need to reuse the same object rather than creating a new control every time.

Solution: To resolve this problem we have to open the task manager and add the columns Handles, Threads, User Objects, GDI Objects by clicking the View-> Select column. Now run your application and check which is increasing frequently once you complete the functionality. In my application I found the USER Objects increasing very quickly. I check my code and found that I was not disposing the objects and so its increasing. In my application I found that User Objects reach 10000 and it locks to load controls. So to resolve it I have set the objects to null and dispose the controls which were not required and when the window is going to close. It can possible that problem can arise from the Handlers. So at this time we have to detach all the event handlers when we close the window or we have to check is the handler is exist and if not exist then we have to create it else not. So this is one of the important article I faced it and really interested thats possible even .Net has Garbage Collection features. So we should remember that we don’t require any control just dispose it. So keep in mind it because its very important.

You can add your comments and suggesions here. Do it yaar……

Regards,
Vijay Modi

Advertisements

About Vijay Modi

Having 12+ years of experience in web application development. Expertise in various domains like E-Commerce, E-Learning, Insurance. I have expertise in web application development, window application development, Performance improvement, bug fixing etc. I am believing in quality work and achieving deadlines. Also like to work on new technologies and quick learner.
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

6 Responses to Error creating window handle

  1. imran says:

    before opening form first suspend it and then resume it ..
    this will resolve your issue…

    imran saeed
    F3 Technologies
    Rawalpindi
    Pakistan

  2. umangi shah says:

    How did you find out the objects which you were not disposing

  3. Vijay Modi says:

    hi Umangi,

    You should debug your application & find it. you can dispose object by using

    objName.dispose();

    regards,
    vijay modi

  4. Tyler Gislason says:

    Thanks! I had a similar problem and I fixed it by disposing my objects.

    You saved me some time!

  5. Jeremy Hatchel says:

    Hello –

    I work in the tech field and I am working with a client that uses HP QC and when she goes into the daskboard to fun a filter she get the Error Creating Window Handle. Now keep in mind I am not a programmer or know anything about code so please forgive me. I did go into the registry and saw that the UserObjectHandle was set to 2710 so I changed it to 10000 and rebooted the Xendesktop and this did not resolve the issue. How can I resolve this error and keep the application from throwing this error? Keep in mind if you are going to come back with enter in a command, I know NOTHING about it and I don’t even know where to begin or how to use it or what to use to write the code or where to place it once I have completed the task. I am a windows / hardware/ some software tech I do not get into to DBA and .NET and things like that

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s