cpicciri

ArcMap threading form with progress bar

Discussion created by cpicciri on Apr 9, 2012
Latest reply on Apr 10, 2012 by cpicciri
Hi everyone,

I've been fighting with this problem for almost a week now and I am no closer to a solution than when I started so I am hoping someone has some ideas for me. I've read LOTS of ESRI documentation as well as lots of forums post asking similar things but no concrete solutions.

I have a form where the user enters a number to search for into an input box. When the user clicks the OK button, the search code runs. The problem is that the search code takes several minutes to complete and I want to give the user some indication that the code is running and not locked up. I've tried to set the MouseCursor to hourglass but it's not consistent for some reason, sometimes the hourglass stays on for the entire search like I want it to do and sometimes it does not.

So, I have added a progress bar to my menu below in the input box and set it's ProgressBarStyle to Marquee. I can turn the progress bar on (visible = true) and it updates once but after that, the bar does not move anymore and the progress bar goes away (visible = false) when the search is done.

WAY back in the AML days, I could display a "please wait" form on top of the search form in a separate thread until the search was over and then get rid of the thread. Trying to do the same here except figured I would get fancier and put the progress bar on the main form instead of opening another form.

I've read some ESRI documents that at times seems to indicate this is not doable but I am not sure. Can someone help me out with some sample code or at least give me a yes or no on whether what I am trying to do is even possible or should I abandon my current code and try something else.

I am programming in C# using ArcGIS 9.3 and Visual Studio 2008 and .NET 3.5

Thanks,
Carlos

Outcomes