Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do u step thru code line by line like F10 in VB

Status
Not open for further replies.

Mb2b

IS-IT--Management
Feb 6, 2008
9
US
How do step thru code to debug line by line .. to see what is happening .... like u step line by line in VB or ASP.NET using the F10 key .. new to VFP

Thanks
 
There are a couple of ways to step through the code.

The first step is to open a 'window' in which to watch the code execute.

From the VFP command window ACTIVATE WINDOW TRACE

From here you can launch a program and use the STEP icons to move through the code.

Additionally you can insert Breakpoints into your code and then run it until one of the Breakpoints is hit.

Thirdly you can put a SET STEP ON into your code and execute it. When in the Development mode, the SET STEP ON will automatically open the TRACE window from which you can STEP through the code in a variety of ways
1. A line at a time
2. Run until the next Breakpoint
3. Run until you leave the specific sub-routine (e.g. Function)
4. Step Over a sub-routine.

You can simultaneously use the WATCH Window to examine the contents of variables as the code executes.

It may take some 'playing' around with it to get comfortable with it, it works.

Good Luck,
JRB-Bldr
 
One other note. You have a choice with VFP as to whether the Debugger runs in its own frame (the "Debug frame") or in the VFP frame. The default is the Debug frame, which gives the Debugger its own presence on the task bar. In that case, the command to open it is Debug, or you can use Tools | Debugger from the menu.

In general, I recommend against putting SET STEP ON in your code (or any other commands that you have to remove before deploying). The Trace and Watch windows let you set breakpoints, as do all code windows. It's very rare for me to find a case where I can't set the appropriate breakpoint to get me into the code where I want.

Tamar
 
Cool. Some progress .. but run into a problem. OK

Say I'm able to step F8

Line by Line in ProgA.
(ProgA displays a menu selection .. I select and hit Enter)
Then ProgA calls ProgB .....

ProgB just runs straight thru without breaking to allow me to step line by line. In the Trace window, I keep seeing a message "Source out of date" ....

ProgB runs fine though but I want ProgB to break so I can step line by line thru. Actually I set a breakpoint in ProgB or so I believe!. I see a RED circle at my breakpoint at line 6 in ProgB... (Tools/Breakpoint .. Type. location, file ... but its not breaking .. Pls help

Must say though that in some other different menu paths or selection though, say going from ProgA to ProgC .. it seems to break in ProgC by itself as I hit F8 ...

But as far as the selection to ProgB .. it just runs through without breaking .. Any suggestions?

This is code I inherited and have no idea whats going on .. so I have to step thru to get an idea .. kinda Columbo programming :)
 
Source out of date" can be resolved by re-compiling ProgB.

If ProgB 'lives' in a different directory than the ProgA, you will need to copy/move the ProgB.frx (compiled result) into that directory.

The Trace Window is actually executing the Breakpoint Break when it hits it (the red dot) in ProgB, but since it does not think that the code is current, it cannot display it.

Assuming that you have the current compiled code version available to it, you can manually follow the code by using the STEP icons (INTO or OVER) to move through the code.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top