6

I am writing a program in VB6.

By mistake many times my code contains an endless loop, inside which there is a message box. For example:

while a>0
    msgbox "a is positive"
wend

Then I press the play/run and I realize what has happened. Is there any way to stop the debugging/running of my program?

The only thing that works so far is Ctrl+Alt+Del and end task. But this way the whole visual basic closes and I lose my unsaved data. (please don't comment that I should save my program more often. I know it (now)).

Edit: I found on the internet that maybe esc or ctrl+c or ctrl+break could do the job. The first two do nothing and my laptop doesn't have a break key

Solution: I have the insert key in my laptop. on the key there is also written pause for use along with the Fn key. So I was able to break the application by pressing Ctrl+Fn+Insert (which maybe could be translated in Ctrl+Pause)

edit: link to photo of my keyboard:

Thanos Darkadakis
  • 1,669
  • 2
  • 18
  • 30

1 Answers1

24

ctrl + break will work. If you don't have those keys, use the on screen keyboard.

Start | Run | osk

Then press ctrl + break.

Mark
  • 106,305
  • 20
  • 172
  • 230
  • thanks for that "other way". I couldn't find the break in the osk either. however i solved my problem. i'm editing my question – Thanos Darkadakis Feb 24 '14 at 20:26
  • 2
    @ThanosDarkadakis, with the on screen keyboard for Win7, `ctrl` + `pause` should get you a break. – Mark Feb 24 '14 at 20:34
  • If you also don't have OSK for some reason you can use `SendKeys` from PowerShell for example: `[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms"); sleep 1; [System.Windows.Forms.SendKeys]::SendWait("^{BREAK}")` (type in PowerShell) Reference: [1](https://www.jesusninoc.com/11/05/simulate-key-press-by-user-with-sendkeys-and-powershell/) [2](https://stackoverflow.com/questions/27791783/powershell-unable-to-find-type-system-windows-forms-keyeventhandler) – user202729 Oct 12 '21 at 05:27