Click here to Skip to main content
15,880,608 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to reduce the time(Performance Improvement) Please Help me

What I have tried:

How to reduce the time(Performance Improvement) Please Help me 
Posted
Updated 9-Jul-22 8:53am
Comments
Richard MacCutchan 9-Jul-22 12:25pm    
ShowDialog waits for user input. So if the user does not respond it will wait until the end of time.

1 solution

ShowDialog is a modal operation: it does not return until the form is closed.
So depending on what the form you called ShowDialog on is doing when it loads and whether it requires the user to close it, your calling code may wait some considerable time.

Since we have no idea what the form does, how it does it, or even what it looks like we can't c=give you specific instructions, but you could either use Show instead of ShowDialog (which return pretty much immediately while the form loads asynchronously); speed up the processing in the Form.Load and Form.Shown event handlers; or remove user input and close the form programmatically.

Do note that if you use Show instead of ShowDialog, you will need to monitor the form via it's Form.Closed event in order to "know" when it is finished if you want to prevent multiple instances.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900