CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2004
    Posts
    158

    Pausing a program.

    Is there any way I can pause my program and for it to need a key-press to resume?

    Thank you.

    Net 2008
    I use VB.Net 2008 in all my wash, for those whiter whites.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Pausing a program.

    Console application, or windows form app? The console can pause only while waiting for input, unless you use SLEEP() to pause execution
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Pausing a program.

    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.

  4. #4
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Pausing a program.

    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.
    Always use [code][/code] tags when posting code.

  5. #5
    Join Date
    Apr 2004
    Posts
    158

    Re: Pausing a program.

    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.
    I use VB.Net 2008 in all my wash, for those whiter whites.

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Pausing a program.

    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?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    Join Date
    Aug 2009
    Location
    NW USA
    Posts
    173

    Re: Pausing a program.

    Could use a MsgBox with a simple OK button or InputBox if you wanted to capture a string

  8. #8
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Pausing a program.

    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.
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured