Worker thread problem
-
Dear all, In my program, I have written a method to send out an e-mail. However, my entire GUI freezes for a moment until the e-mail has been sent. I would like to create a worker thread that sends the e-mail ( invoke the method from that thread ) so that my main GUI stays alive and functional. I've looked through many examples on the net, but they are all a bit of an overkill. I remember there was an easy way of doing it. Can anyone please point me in the right direction. Cheers, Rick
-
Dear all, In my program, I have written a method to send out an e-mail. However, my entire GUI freezes for a moment until the e-mail has been sent. I would like to create a worker thread that sends the e-mail ( invoke the method from that thread ) so that my main GUI stays alive and functional. I've looked through many examples on the net, but they are all a bit of an overkill. I remember there was an easy way of doing it. Can anyone please point me in the right direction. Cheers, Rick
Well, generally speaking, multi-threaded applications are not that simple. However, you can use the BackgroundWorker or ThreadPool, those are the easiest to deal with, especially suitable in situations like yours. Check thisout:
If you still have issues post back
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Coo
-
Dear all, In my program, I have written a method to send out an e-mail. However, my entire GUI freezes for a moment until the e-mail has been sent. I would like to create a worker thread that sends the e-mail ( invoke the method from that thread ) so that my main GUI stays alive and functional. I've looked through many examples on the net, but they are all a bit of an overkill. I remember there was an easy way of doing it. Can anyone please point me in the right direction. Cheers, Rick
-
Well, generally speaking, multi-threaded applications are not that simple. However, you can use the BackgroundWorker or ThreadPool, those are the easiest to deal with, especially suitable in situations like yours. Check thisout:
If you still have issues post back
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Coo
Mustafa Ismail Mustafa wrote:
However, you can use the BackgroundWorker or ThreadPool, those are the easiest to deal with, especially suitable in situations like yours.
Wha??? See my post. I dont understand why people want to revert to monsters!
xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 1 out now -
Mustafa Ismail Mustafa wrote:
However, you can use the BackgroundWorker or ThreadPool, those are the easiest to deal with, especially suitable in situations like yours.
Wha??? See my post. I dont understand why people want to revert to monsters!
xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 1 out nowHmmm, live and learn. I've never actually had to send an email through C#. Thank you leppie, much obliged :)
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Coo
-
Mustafa Ismail Mustafa wrote:
However, you can use the BackgroundWorker or ThreadPool, those are the easiest to deal with, especially suitable in situations like yours.
Wha??? See my post. I dont understand why people want to revert to monsters!
xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 1 out nowleppie wrote:
I dont understand why people want to revert to monsters!
OK - I now have an image of Scooby Doo in my head and it's not going away. Thanks for that.
Deja View - the feeling that you've seen this post before.