IProgressDialog2, can't hide if there's an error, ArcMap is frozen/stuck

848
5
01-03-2013 11:07 AM
KevinAndras
New Contributor II
I'm using code similar to the "Show Progress Dialog Snippet", which is inside a Try - Catch - End Try block.  When there's an error, the code exits the subroutine, which is what I want it to do, but the progress dialog is still up, and I can't get it to go away, and nothing else can be done until I force ArcMap to shut down.

Does anybody know how to hide the progress dialog when there's an error?  I suppose I could make it a public variable, so the error handler can see it, but that seems pretty roundabout.

Thanks!
0 Kudos
5 Replies
NeilClemmons
Regular Contributor III
You don't have to make the progress dialog public.  All you need to do is declare it outside of the Try/Catch.
0 Kudos
KevinAndras
New Contributor II
Thanks, Neil!
0 Kudos
DubravkoAntonic
New Contributor III
You don't have to make the progress dialog public.  All you need to do is declare it outside of the Try/Catch.


Or hide it in finally statement.
0 Kudos
NeilClemmons
Regular Contributor III
Or hide it in finally statement.


It would still have to be declared outside of the Try/Catch.  Variables declared within the Try/Catch do not have scope in the Finally clause.
0 Kudos
DubravkoAntonic
New Contributor III
Neil, you're totally right.
0 Kudos