-
Jan 25th, 2005, 11:10 AM
#1
Thread Starter
Frenzied Member
changing the point of execution
Hello
Cani move the point of execution, i mean if i break the program execution and want the program to start from a certain point can i do it.
something like place the cursor at some point and start the execution from that point (on the same form of course)
i know this is possible in assembly language(yes VB and assembly language are like apples and eggs )
Last edited by vb_student; Jan 25th, 2005 at 12:14 PM.
-
Jan 25th, 2005, 11:12 AM
#2
Lively Member
Re: changing the point of execution
You mean while in the IDE?
You can press CTRL + BREAK to break execution, or put a stop point next to a line of code by clicking next to it. then F8 to skip through.
Or have I misunderstood your question?
Naughty but Nice
-
Jan 25th, 2005, 11:36 AM
#3
Re: changing the point of execution
If you are already in break mode you can set the next statement to be executed (but only in the same procedure).
The statement which is about to be executed is shown in yellow, with a little arrow in the left border. You can drag this to another line, or right click on another line (again in the same procedure) and select "Set next statement".
-
Jan 25th, 2005, 12:14 PM
#4
Thread Starter
Frenzied Member
Re: changing the point of execution
thanks dudes
i tried to drag it to another form(hehe) but it failed
-
Jun 5th, 2010, 10:56 AM
#5
Lively Member
Re: changing the point of execution
is there anyway to change the point while the program is executing?
I know you can jump to a different subroutine but the execution returns after that. Is there anyway to make it jump without comming back?
--- Science does not explain why things are what they are. What we get from Science is our interpretation of how things do what they do.
--- No Scientific law of the universe is stable, we did not create it, and we will never understand all of its abilities.
--- What we determine as reality is a mere assumption of what tomorrow will be based on what yesterday was.
-
Jun 5th, 2010, 11:22 AM
#6
Re: changing the point of execution
Originally Posted by Resilience
is there anyway to change the point while the program is executing?
I know you can jump to a different subroutine but the execution returns after that. Is there anyway to make it jump without comming back?
Sure, if the procedure you call terminates the application via End.
Otherwise, you could use a function or byref parameter to inform the calling procedure to Exit Sub/Function upon return.
Software I use and highly recommend: Opera, Miranda IM, Peerblock, Winamp, Unlocker Assistant, JoyToKey, Virtual CloneDrive, Secunia PSI, ExplorerXP, GOM Player, Real Alternative, Quicktime Alternative,Sumatra PDF, and non-freeware: Photoshop and VB6().
My codebank: AllRGB, Rounded Rectangle(math), Binary Server, Buddy Paint, LoadPictureGDI+, System GUID/Volume Serial, HexToAsc, List all processes and their paths, quasiString matching
Strings(search, extraction, retrieval etc): Retrieve BBCode Link from HTML, RemoveBetween ()'s, strFindBetween(str1,str2), Insert text in HTML, HTML - GetSpanByID
-
Jun 5th, 2010, 11:41 AM
#7
Re: changing the point of execution
I don't know if it will help you but when you are at a breakpoint you can execute any procedure in your app by typing the name of the sub into the Immediate window and pressing return.
-
Jun 5th, 2010, 11:48 AM
#8
Lively Member
Re: changing the point of execution
Otherwise, you could use a function or byref parameter to inform the calling procedure to Exit Sub/Function upon return.
Yeah thats what i was figuring. I dont know a whole lot about vb6 and its capabilites so i thought i would ask. I use timers to cycle the execution and the way i imagine it is like a tree.
Each subroutine being a new branch on the trunk, without the execution being able to return through the same route that it came it wont be able to get back to the trunk. Does that make sense? I assume thats how it must work. So you wouldnt be able to go from a subroutine back to the trunk (without returning) otherwise it would create an ever deep endless loop, i guess?
--- Science does not explain why things are what they are. What we get from Science is our interpretation of how things do what they do.
--- No Scientific law of the universe is stable, we did not create it, and we will never understand all of its abilities.
--- What we determine as reality is a mere assumption of what tomorrow will be based on what yesterday was.
-
Jun 5th, 2010, 12:06 PM
#9
Re: changing the point of execution
Resil
If your Call Stack looks something like this:
Proj1.Sub3
Proj1.Sub2
Proj1.Sub1
.. and you are currently in Sub3, and upon completion
.. you want to skip the rest of the code in Sub2,
you could put an Exit Sub statement in Sub2.
You would want to do this in an If .. End If branch.
You would then skip rest of the code in Sub2 and go back to Sub1.
Is that what you are looking for?
Spoo
-
Jun 5th, 2010, 12:10 PM
#10
Re: changing the point of execution
Seems like something for conditional structures, such as IF|THEN or SELECT CASE, etc.
I don't really follow your trunk analogy... except in terms of conditional constructs.
General procedural execution is more like a deck of cards(the cards being procedures/subroutines). One is placed on the stack until it fully resolves(completes and sometimes returns a value) and then it is removed. If a procedure calls a subroutine it's added to the stack(on the top). When the subroutine then resolves, it is removed from the stack(the top), and execution resumes with the next card on the stack(again, the top card, which would likely be the calling procedure). VB uses what is essentially a LIFO (last in, first out) stack, or sometimes called FILO (first in, last out).
Software I use and highly recommend: Opera, Miranda IM, Peerblock, Winamp, Unlocker Assistant, JoyToKey, Virtual CloneDrive, Secunia PSI, ExplorerXP, GOM Player, Real Alternative, Quicktime Alternative,Sumatra PDF, and non-freeware: Photoshop and VB6().
My codebank: AllRGB, Rounded Rectangle(math), Binary Server, Buddy Paint, LoadPictureGDI+, System GUID/Volume Serial, HexToAsc, List all processes and their paths, quasiString matching
Strings(search, extraction, retrieval etc): Retrieve BBCode Link from HTML, RemoveBetween ()'s, strFindBetween(str1,str2), Insert text in HTML, HTML - GetSpanByID
-
Jun 5th, 2010, 12:26 PM
#11
Lively Member
Re: changing the point of execution
firextol, yeah thats alot like what i was imagining. thanks for the help.
spoo, thats what i was figuring. Starting at Sub1 and ending up at Sub3 I wanted to go straight back to Sub1 without returning to Sub2. But as you said, i'll have to use a variable.
I'm making a global variable such as "Public NeedExit as boolean"
and am going to place it in Sub2 just after the place where i call Sub3. That way i can get back to the original Sub1 that i need without processing Sub2.
I had an idea that was an option but i was hoping for something better. I have alot of calls to alot of code and it looks "ugly" having those "If NeedExit Then Exit Sub" statments everywhere. I appreciate your guys help and have added to your reputation.
--- Science does not explain why things are what they are. What we get from Science is our interpretation of how things do what they do.
--- No Scientific law of the universe is stable, we did not create it, and we will never understand all of its abilities.
--- What we determine as reality is a mere assumption of what tomorrow will be based on what yesterday was.
-
Jun 5th, 2010, 01:27 PM
#12
Re: changing the point of execution
I just want to make sure you understand that if you execute this code you will see
This
is
a
test
Code:
Private Sub Form_Load()
Sub1
MsgBox "test"
End Sub
Public Sub Sub1()
MsgBox "This"
Sub2
End Sub
Public Sub Sub2()
MsgBox "is"
Sub3
End Sub
Public Sub Sub3()
MsgBox "a"
End Sub
-
Jun 5th, 2010, 01:57 PM
#13
Lively Member
Re: changing the point of execution
Originally Posted by MartinLiss
Code:
Private Sub Form_Load()
Sub1
MsgBox "test"
End Sub
Public Sub Sub1()
MsgBox "This"
Sub2
End Sub
Public Sub Sub2()
MsgBox "is"
Sub3
End Sub
Public Sub Sub3()
MsgBox "a"
End Sub
Yeah I understand. Basically what im doing is:
VB Code:
public NeedExit as boolean
dim TempString as string
Private Sub Form_Load()
Sub1
TempString = TempString & "test"
End Sub
Public Sub Sub1()
TempString = TempString & "This"
Sub2
End Sub
Public Sub Sub2()
TempString = TempString & "is"
Sub3
If NeedExit Then Exit Sub
TempString = TempString & "longer"
End Sub
Public Sub Sub3()
TempString = TempString & "a"
if TempString = "This is a" then
NeedExit = True
exit sub
End If
End Sub
So i'll get the execution back to form_load with my string being "This is a test" instead of the string being "This is a longer test"
--- Science does not explain why things are what they are. What we get from Science is our interpretation of how things do what they do.
--- No Scientific law of the universe is stable, we did not create it, and we will never understand all of its abilities.
--- What we determine as reality is a mere assumption of what tomorrow will be based on what yesterday was.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|