PC Review


Reply
Thread Tools Rate Thread

Can I pause without starting in a thread (in a forever loop)?

 
 
trint
Guest
Posts: n/a
 
      20th Sep 2005
I need to know what the safest way to loop(without starting off in a
new thread since UI controls are involved) is...and how to
pause in the loop so that the program runs normally.
Any help is appreciated.
Thanks,
Trint

 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      20th Sep 2005
trint <(E-Mail Removed)> wrote:
> I need to know what the safest way to loop(without starting off in a
> new thread since UI controls are involved) is...and how to
> pause in the loop so that the program runs normally.


Unless your code is pretty much *purely* UI calls, you should use a
thread, and use Control.Invoke to marshall calls back to the UI when
you need to.

If you really are doing a huge amount of work that's just UI calls, you
could use Application.DoEvents, but personally I'd try to avoid that
and use another thread.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
trint
Guest
Posts: n/a
 
      21st Sep 2005
Jon,
I am making mostly calls to controls and each loop will open, read and
close sql server 2000 4 times. I wish that I felt more comfortable
with threads, which are great for non UI calls, that use
control.invoke.
Any ideas?
Thanks,
Trint

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pause Debugger in worker thread possible? Zytan Microsoft C# .NET 6 27th Apr 2007 10:13 PM
Windows app, add a thread and pause for audio... =?Utf-8?B?aHpndDliQG5vcG9zdC5jb20=?= Microsoft Dot NET 3 7th Oct 2005 02:58 PM
pause a loop GrantMagic Microsoft ASP .NET 1 28th Jul 2004 11:08 AM
Pause In Kiosk and then continue to loop after pause DoKo Microsoft Powerpoint 2 17th Dec 2003 07:00 PM
Beginner: Thread not starting before UI Thread finishes? Eric Mamet Microsoft Dot NET Framework 2 10th Nov 2003 12:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:25 PM.