Computing.Net > Forums > Programming > pause the program in c#

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

pause the program in c#

Reply to Message Icon

Name: coolkang
Date: February 28, 2005 at 02:03:17 Pacific
OS: xp
CPU/Ram: 512
Comment:

hello
I need a code in C# that will pause a function and run it again to check the database. Could somebody please help me.
thank you



Sponsored Link
Ads by Google

Response Number 1
Name: Chi Happens
Date: March 1, 2005 at 06:06:35 Pacific
Reply:

this is confusing. you want to pause the function while in the middle of execution? or you want to run the function periodically?

If you want to run the function periodically, then you can set up a timing thread to call that function at a set time.

If you want to pause the execution of the function, you need to be able to respond to an external event (like a keypress) and then simply loop while the value is set.

i.e.
while(IAmPaused);

of course you will need to make certain that this loop can exit and that the application can respond to messages (such as unpausing).

i.e.:
while(IAmPaused)
{
Application.DoEvents();
}

Hope this helps,
Chi

They mostly come at night...mostly


0
Reply to Message Icon

Related Posts

See More


executing command shortcu... VB - Get IP from DirectPl...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: pause the program in c#

Piano programming in C www.computing.net/answers/programming/piano-programming-in-c/17611.html

beginners programming in c www.computing.net/answers/programming/beginners-programming-in-c/11037.html

Programming in C www.computing.net/answers/programming/programming-in-c/7343.html