Select to view content in your preferred language

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

947
5
01-03-2013 11:07 AM
KevinAndras
Emerging Contributor
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
Honored Contributor
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
Emerging Contributor
Thanks, Neil!
0 Kudos
DubravkoAntonic
Occasional Contributor
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
Honored Contributor
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
Occasional Contributor
Neil, you're totally right.
0 Kudos