Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

haulting the program? 1

Status
Not open for further replies.

A1METALHEAD

Programmer
May 21, 2004
76
US
is it possable to stop the program(like inside a infinite loop) for some time(like 5 seconds), but be able to acualy do things to the program(like click on buttons and stuff)?

ty,
METALHEAD
 
Ctrl+Break.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
i ment, the loop is srill running, but it is haulted for a couple seconds. but in that time of two seconds you can click on stuff.
 
Perform your long-running work on a second thread. That way the UI remains responsive to the user, and you can set a flag to cancel/suspend/resume the worker thread.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
and also, i searched for file i/o, and it dosent let me make a filestream. is there a using dir i have to put in or somthing?
 
Why can't you create a FileStream object? The docs on one of it's constructors says this:
Code:
Initializes a new instance of the [u]FileStream[/u] class with the specified path and creation mode.

public FileStream(
   string path,
   FileMode mode
);

Parameters
[i]path[/i]
[tab]A relative or absolute path for the file that the current FileStream object will encapsulate. 
[i]mode[/i] 
[tab]A [u]FileMode[/u] constant that determines how to open or create the file.

For creating a second thread, a good example is at:
The static void ThreadProc method does the work, while the static void Main method just starts it, and waits for it to finish.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
im am using the beta for 2005. i am aobut to buy 2003.net tho.
 
um, i looked in msdn, and found how to use a file in 2005. thanks for your help!
 
When I click on a button a set of code starts to execute. In the middle I want to bring up a Form and input some data then continue right after the commands that brought up the Form.

The code brings up the form OK but continues on executing the code following the commands that brought the form up and does not wait for the data to be input.

How do I stop the code to let me input data?

 
the threads can be paused then resumed. this should help you. (e.g. on the form open, pause the thread that just opened the form and on form close resume it)

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top