Solved

Windows Explorer being affected after VB.Net application closes.

Posted on 2014-04-10
6
338 Views
Last Modified: 2014-04-11
Thought I had discovered a solution to my problem but I guess not.  I thought that it was the built-in context menus in vb2008 that caused Windows Explorer to restart over and over after shutting the application down and using the right mouse button.  But after eliminating them, the problem still persists.  The only way to correct it is to shut down and restart Windows.

I realize this is probably a very ambigous question, but does anyone have an suggestions where to look for the problem within vb 2008.  I am not using any third party add ins.  Everything being used is from Microsoft.

Thanks in advance.
0
Comment
Question by:GCCal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 40
ID: 39993166
If the problem starts to happen only after you close the application, then I would first look at the code that runs when you do stop the application.
0
 

Author Comment

by:GCCal
ID: 39993204
Here is my shut down code.  See anything wrong with it, James.  Thanks....

        Try
            Microsoft.VisualBasic.DeleteSetting("NewCVR", "MySoftware", "Edit")
        Catch ex As Exception
            'do nothing
        End Try
        If MessageBox.Show("Confirm exit?", "Quit Color Video Report?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Cancel Then
            Exit Sub
        Else
            If MyPictureBoxes(0).Image Is Nothing Then

            Else
                If MessageBox.Show("Do you want to save the video report before exit?", "Save Video Report?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
                    'Do nothing.....continue with exit
                Else
                    mnuSave.PerformClick()
                End If
            End If

            GC.Collect()
            Me.Dispose()
            Application.Exit()
            GC.Collect()
        End If
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 39993234
GC.Collect? And twice? And after you requested that the application Exit?

Although you see it all over the place, there are very few instances where calling GC.Collect is a good thing. You are overriding the normal garbage collection mechanism (memory cleanup) when you call that method.

Assuming that you are in a Form, calling Dispose is usually quite sufficient.

And as stated in the documentation, GC.Collect "performs a blocking garbage collection", which means that it needs to stop currently running processes while it is cleaning up memory. Normally, it should not have an impact on Windows Explorer, since it is not a .NET application and the GC works only on .NET memory allocation, but who knows.

If removing GC.Collect does not solve your problem, put a breakpoint on Application.Exit, and step through the code with F11. Depending on how the application was started and what you did while it was running, some other code can run even after Exit.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:GCCal
ID: 39993236
Okay, thanks James. I will give it a try and get back with you either today or tomorrow.
0
 

Author Comment

by:GCCal
ID: 39994346
Thanks James.  I did as you suggested.  I delete GC and am only using Application.Exit.  Then I step through my code from that point and think I have found code that may have been causing me the problems.  Anyway, it has not occurred three times after shutting the software down.

Thanks for your help.
0
 

Author Closing Comment

by:GCCal
ID: 39994351
Thanks for the expert advice....
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question