VS 2008 C# Screen Lockups

I have a series class libraries that I have added to an external application that present various screens to the users. About 2 or 3 times a month all screens become unresponsive and the solution is to leave the application and come back in. It is virtually impossible to repeat what is causing this, I have tested all the screens individually and inside each program I have error capture routines that never return anything, the programs simply do not run. What kinds of traps can I use to determine why they fail to fire when called? I have attached a sample of my code to show how I invoke forms.
public void ViewAppliedDocuments(object sender, EventArgs e)
        {
            if (ViewAppliedDocumentsForm == null || ViewAppliedDocumentsForm.Created == false)
            {
                ViewAppliedDocumentsForm = new frmViewAppliedDocuments();
            }

            ViewAppliedDocumentsForm.Show();
            ViewAppliedDocumentsForm.Activate();
            ViewAppliedDocumentsForm.Focus();
        }

Open in new window

rwheeler23Asked:
Who is Participating?
 
JuanCarnigliaConnect With a Mentor Commented:
Check that you are correctly disposing this forms, use also a try-catch block, and keep memory usage in check. Maybe you will have to call the garbage collector.

Greetings
0
 
rwheeler23Author Commented:
Good point, there are about 12 pieces of code. I will check them all for the disposal of the form. All of my programs have an exit button plus they can click on the 'X' . I will  make sure the dispose method is in both places. I have never used the garbage collector. Can you provide any links that provide insight on how to use this?
0
 
JuanCarnigliaConnect With a Mentor Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.