PC Review


Reply
 
 
RobcPettit@yahoo.co.uk
Guest
Posts: n/a
 
      23rd May 2006
Hi, Ive got a text box on a form and my program collect values. When
its running id like it to update my text box after each 50 values. How
do I get the program to pause, update the textbox then continue. I can
do the count ok, and get the values it doesnt update the textbox
though. I using if( x - y == 50) textbox = etc.
Regards Robert

 
Reply With Quote
 
 
 
 
Marc Gravell
Guest
Posts: n/a
 
      23rd May 2006
In a tight loop (which it sounds like you are) the nasty way is to call
Application.DoEvents(); after each 50.

This gets the job done, but isn't really nice; a better (but more complex)
way involves using a background thread and eventing, or a background worker
component (which does the same under the bonnet).

Marc


 
Reply With Quote
 
 
 
 
RobcPettit@yahoo.co.uk
Guest
Posts: n/a
 
      23rd May 2006
Thanks for a quick response, Ill have a read up on background threads.
Regards Robert

 
Reply With Quote
 
Marc Gravell
Guest
Posts: n/a
 
      23rd May 2006
Fair enough...

Also - I kinda assumed in your original post that the textbox itself wasn't
the problem; using the grungy DoEvents() approach, this would look something
like:

int counter = 0;
while(someLoopCondition) {
DoSomethingInteresting();
counter++;
if(counter % 50 == 0) {
someTextBox.Text = counter.ToString();
Application.DoEvents(); // hate hate hate
}
}

Marc


 
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
Stop / Pause a Macro using Pause button scott56hannah Microsoft Excel Programming 4 27th Jun 2008 12:48 PM
How do I pause and continue an audio track after pause =?Utf-8?B?dGRtYXNvbjQx?= Microsoft Powerpoint 1 4th Jul 2006 08:11 PM
Pause Internet! Pause Respond! =?Utf-8?B?TWVocmFkU3lz?= Windows XP General 3 8th Oct 2005 01:33 AM
Pause In Kiosk and then continue to loop after pause DoKo Microsoft Powerpoint 2 17th Dec 2003 08:00 PM
TV On Demand Audio Help...pause live tv..audio does not pause Greg ATI Video Cards 0 18th Oct 2003 05:02 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:57 PM.