Hi all,

I have a form in a VB.NET windows application that, when a button is
clicked, runs a pretty intense database process which can take up to ten
minutes to finish. While it's running, I would like to be able to send data
to the form so that the user knows the the application is still running.

In ASP.NET, I would run this method in a new thread, and then simply update
the form occasionally with data from the application. Is the approach in a
windows application similar? And help and/or pointers would be greatly
appreciated.

Thanks,

Wade

Re: Send data to form during intense method. by Wade

Wade
Fri Aug 19 10:41:12 CDT 2005

Not sure if this is the best way to do this, but here's what I did ...

1. Created a new thread. The thread invokes the intense method.
2. I start the thread. The method called by the thread periodically updates
some status labels on the form.
3. I also created a timer that runs every second.
4. The timer checks to see if the thread is still alive. If so, it keeps
the controls disabled and prevents the form from being closed. If it's not,
then I know it's completed and I can wrap things up.

That sound like the right way to do this?

Thanks!


"Wade" <wwegner23NOEMAILhotmail.com> wrote in message
news:uS6O8DNpFHA.3512@TK2MSFTNGP15.phx.gbl...
> Hi all,
>
> I have a form in a VB.NET windows application that, when a button is
> clicked, runs a pretty intense database process which can take up to ten
> minutes to finish. While it's running, I would like to be able to send
> data to the form so that the user knows the the application is still
> running.
>
> In ASP.NET, I would run this method in a new thread, and then simply
> update the form occasionally with data from the application. Is the
> approach in a windows application similar? And help and/or pointers would
> be greatly appreciated.
>
> Thanks,
>
> Wade
>



Re: Send data to form during intense method. by SharpCoderMP

SharpCoderMP
Fri Aug 19 10:50:16 CDT 2005

Wade wrote:
> Not sure if this is the best way to do this, but here's what I did ...
>
> 1. Created a new thread. The thread invokes the intense method.
> 2. I start the thread. The method called by the thread periodically updates
> some status labels on the form.
> 3. I also created a timer that runs every second.
> 4. The timer checks to see if the thread is still alive. If so, it keeps
> the controls disabled and prevents the form from being closed. If it's not,
> then I know it's completed and I can wrap things up.
you dont need timer. your form can be enabled or disabled by a thread.
bur i wouldn't do that - it's because it would be nice to allow the user
co cancel this 10minute job. you should at least put a "cancel" button
somwhere that stops your thread and lets the user to take over control.
>
> That sound like the right way to do this?
>
> Thanks!
>
>
> "Wade" <wwegner23NOEMAILhotmail.com> wrote in message
> news:uS6O8DNpFHA.3512@TK2MSFTNGP15.phx.gbl...
>
>>Hi all,
>>
>>I have a form in a VB.NET windows application that, when a button is
>>clicked, runs a pretty intense database process which can take up to ten
>>minutes to finish. While it's running, I would like to be able to send
>>data to the form so that the user knows the the application is still
>>running.
>>
>>In ASP.NET, I would run this method in a new thread, and then simply
>>update the form occasionally with data from the application. Is the
>>approach in a windows application similar? And help and/or pointers would
>>be greatly appreciated.
>>
>>Thanks,
>>
>>Wade
>>
>
>
>