Is there any way I can pause my program and for it to need a key-press to resume?
Thank you.
Net 2008
Printable View
Is there any way I can pause my program and for it to need a key-press to resume?
Thank you.
Net 2008
Console application, or windows form app? The console can pause only while waiting for input, unless you use SLEEP() to pause execution
For a console application ( DOS mode ), you could simply use Read() or ReadLine(). A Windows based app, may be a lot trickier :) An API called WaitForInputIdle comes to mind, if I think very very quickly.
In a Win Forms app the simpliest way would be to load a modal form when you want it to pause and then close it when you want to continue.
Very strange, I did think with VB-net being so powerful and all, that there would be a simple command for this. Well you live and learn.
Thank you for your replys.
The norm is for console apps to only return a value. It either works or it doesn't. If it works, it usually doesn't return anything. What would you want delete to return?
Could use a MsgBox with a simple OK button or InputBox if you wanted to capture a string
It really depends on what your program is doing and how you have coded it, In some cases the pause may just require you to disable a timer, or go into a loop, or disable the controls on the active form, or as mentioned before show a modal form. btw msgbox and input box are both modal forms as is any form shown with the dialog option.
Without knowing what the program is doing and how it is not really possible to know what method would be best here.