From: Shoukat Hayt, Shoukat on
Hi!
i am a professional developer and i have made an antivirus. but when i start
scanning if we click on the dialog or minimize or any other work on that
dialog.
it goes on busy state, and after complition of scaning it will displayed in
actual state.
this occures because i am scnaing and the drawing of form both done in same
thread. i try my best to run in different format but failed. is there any
body who help me. i will be very great full of him.
i think if the code of stop watch like software will help me most.
send me the link where i find that code. or any other help acording to
threading will
be appriciated.

thanx.

shoukat hayat

ch_shoukat222(a)hotmail.com
ch_shoukat222(a)yahoo.com
From: Arne Vajhøj on
On 28-04-2010 15:26, Shoukat Hayt, wrote:
> i am a professional developer and i have made an antivirus. but when i start
> scanning if we click on the dialog or minimize or any other work on that
> dialog.
> it goes on busy state, and after complition of scaning it will displayed in
> actual state.
> this occures because i am scnaing and the drawing of form both done in same
> thread. i try my best to run in different format but failed. is there any
> body who help me. i will be very great full of him.
> i think if the code of stop watch like software will help me most.
> send me the link where i find that code. or any other help acording to
> threading will
> be appriciated.

Do the long running task in its own thread and update the form
via Invoke.

Arne
From: Family Tree Mike on
On 4/28/2010 3:26 PM, Shoukat Hayt, wrote:
> Hi!
> i am a professional developer and i have made an antivirus. but when i start
> scanning if we click on the dialog or minimize or any other work on that
> dialog.
> it goes on busy state, and after complition of scaning it will displayed in
> actual state.
> this occures because i am scnaing and the drawing of form both done in same
> thread. i try my best to run in different format but failed. is there any
> body who help me. i will be very great full of him.
> i think if the code of stop watch like software will help me most.
> send me the link where i find that code. or any other help acording to
> threading will
> be appriciated.
>
> thanx.
>
> shoukat hayat
>
> ch_shoukat222(a)hotmail.com
> ch_shoukat222(a)yahoo.com

The BackgroundWorker class can make threading very simple. Take a look
at the documentation here:
http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx.

--
Mike
From: Peter Duniho on
Shoukat Hayt wrote:
> [...]
> this occures because i am scnaing and the drawing of form both done in same
> thread. i try my best to run in different format but failed. is there any
> body who help me. i will be very great full of him.
> i think if the code of stop watch like software will help me most.
> send me the link where i find that code. or any other help acording to
> threading will
> be appriciated.

As Arne and Mike have said, there are a variety of ways to approach
this, the two main ones being to use a dedicated thread and explicitly
use Control.Invoke() to deal with the UI, and using the BackgroundWorker
which implicitly uses the thread pool as well as implicitly does the
same work Control.Invoke() does when raising the ProgressChanged and
RunWorkerCompleted events.

Beyond that, there have been dozens of threads on these very topics in
this newsgroup. So one good place to start is to just use Google Groups
to search the newsgroup for those discussions.

Pete