C# .NET - Form is closing very slow when I open it with Show() method

Asked By Rahim Huseyn on 31-Oct-12 08:07 AM
Hello Friends!

From MainForm form I open new FormNew.
When I open it with ShowDialog() method, there is no problem when I closing FormNew.
But there is problem when I open this FormNew form with Show() method, it is closing very slow (, there is 40 000 records in dGV on it)

I have to open it with Show() method for some reasons.
Here is question. What should I do?

Thank you very much.
Tom Wilson replied to Rahim Huseyn on 31-Oct-12 10:24 AM
When a form is displayed using ShowDialog the form's close method is not called. The form is hidden when closed and can be shown again without a new instance.  You must call the dispose method.

When using the Show method the forms close method is called when it is closed.

A datagridview with 40,000 records is not user friendly. My suggestion is to provide a filter to reduce the number of records. 

Rahim Huseyn replied to Tom Wilson on 01-Nov-12 09:10 AM
Thank you very much, it helps.