| | |
STOP a process in between .....
![]() |
Consider this code:
now here, i want to stop the execution of a sub-procedure Public Sub exec() which is called by another sub-procedure Private Sub Command1_Click() but without changing or adding any code into Public Sub exec().
even after applying all ur helps it did not work as needed. But all your help was valuable.
How to do it?
(Forgive me for not providing the code earlier.)
visualbasic Syntax (Toggle Plain Text)
Public bc As Boolean Dim x As Long Private Sub Command1_Click() If bc Then MsgBox x GoTo EndHere Else Call exec End If EndHere: End Sub Private Sub Command2_Click() bc = True Call Command1_Click End Sub Private Sub Form_Load() bc = False End Sub Public Sub exec() While 1 = 1 x = x + 10 Label1 = x DoEvents Wend End Sub
now here, i want to stop the execution of a sub-procedure Public Sub exec() which is called by another sub-procedure Private Sub Command1_Click() but without changing or adding any code into Public Sub exec().
even after applying all ur helps it did not work as needed. But all your help was valuable.
How to do it?
(Forgive me for not providing the code earlier.)
Last edited by RahulV; Feb 22nd, 2009 at 11:00 am.
It's a very bad practice to use goto in programming. It is strongly frowned upon by professional programmers, and actually forbidden in business code. Instead, you can use "exit sub" to replace that goto statement. Even that (since it is just a single if statement and nothing else) isn't even necessary, as the code will simply end once the if statement is completed.
Last edited by Comatose; Feb 22nd, 2009 at 12:35 pm.
•
•
•
•
It's a very bad practice to use goto in programming. It is strongly frowned upon by professional programmers, and actually forbidden in business code. Instead, you can use "exit sub" to replace that goto statement. Even that (since it is just a single if statement and nothing else) isn't even necessary, as the code will simply end once the if statement is completed.
Now pls can anyone help me in solving the basic problem being discussed here?
PLEASE HELP !!!
ONCE AGAIN REPEATING THE PROBLEM
•
•
•
•
Consider this code:
visualbasic Syntax (Toggle Plain Text)
Public bc As Boolean Dim x As Long Private Sub Command1_Click() If bc Then MsgBox x GoTo EndHere Else Call exec End If EndHere: End Sub Private Sub Command2_Click() bc = True Call Command1_Click End Sub Private Sub Form_Load() bc = False End Sub Public Sub exec() While 1 = 1 x = x + 10 Label1 = x DoEvents Wend End Sub
now here, i want to stop the execution of a sub-procedure Public Sub exec() which is called by another sub-procedure Private Sub Command1_Click() but without changing or adding any code into Public Sub exec().
even after applying all ur helps it did not work as needed. But all your help was valuable.
How to do it?
(Forgive me for not providing the code earlier.)
![]() |
Similar Threads
- stop a process using php (PHP)
- unclosable process firefox.exe or iexplore.exe (Viruses, Spyware and other Nasties)
- "System Idle Process" (Windows NT / 2000 / XP)
- wupdater.exe error message (Web Browsers)
- CPU is fully used up by a single process, HELP (Windows NT / 2000 / XP)
- CD burner stalling.. (Storage)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: SSTAB problem with TAB2
- Next Thread: access events of form in UserControl
Views: 1441 | Replies: 16
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 7 2007 access activex add application array banned basic beep bmp c++ cd cells.find click client coffeehouse college component connection connectionproblemusingvb6usingoledb convert ctrl+f data database date designer desktop dissertations dissertationthesis edit error excel excelmacro filename form grid group header image installation installer key keypress list listbox listview login machine mail match metadata nice number object objectinsert open oracle password pause pdf prime print printer programmer query random range-objects readfile record refresh registration report reports retrieve save search sites sort sound spectateswamp sql string subroutine table tags textbox time variable vb vb6 vb6.0 vba vista visual visualbasic web windows






