Results 1 to 27 of 27

Thread: Printed trail of each statement a vb6 program goes through.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    23

    Printed trail of each statement a vb6 program goes through.

    i HAVE A VERY COMPLEX VB6 PROGRAM.
    i am looking for a program which will print out a list of the statements a program goes through when I press a certain command button.

    THANK YOU.

  2. #2
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Printed trail of each statement a vb6 program goes through.

    www

    In the old days, Ashton Tate's dBASE IV referred to that as a "trace" and you could obtain exactly what you describe.

    Off-hand, dunno how to do that in VB6 ..

    Spoo

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    23

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by Spooman View Post
    www

    In the old days, Ashton Tate's dBASE IV referred to that as a "trace" and you could obtain exactly what you describe.

    Off-hand, dunno how to do that in VB6 ..

    Spoo
    I am hoping there is a add on program that does this.

  4. #4
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Printed trail of each statement a vb6 program goes through.

    Dang .. I just checked Wiki, and dBASE is still around !!
    dBASE 11 released 8 months ago !!

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    23

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by Spooman View Post
    Dang .. I just checked Wiki, and dBASE is still around !!
    dBASE 11 released 8 months ago !!
    Is there a way I can use dbase to "trace" a vb6 program?
    Not familiar with dBase.

    Anyone else has any suggestions?

  6. #6
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Printed trail of each statement a vb6 program goes through.

    www

    dBASE is a database and programming app. The programming syntax is much akin to VB6.

    But, no, I doubt that dBASE could "trace" a VB6 program.
    Of course, you could always re-write you entire app in dBASE (just kidding).

    Spoo

  7. #7
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: Printed trail of each statement a vb6 program goes through.

    That reminds me of the old COBOL programming days of green bar paper source listings. When you wanted to work a program you went to the "documentation room". Checked out the program and you could read it to your hearts content. Geez...I'm glad those days are gone
    Please remember next time...elections matter!

  8. #8
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Printed trail of each statement a vb6 program goes through.

    As long as we're kicking around useless suggestion, in BASIC you could use TRON to run traces through a program. Don't think VB has that.
    Incidentally, I cut my teeth on dBase II ... that was the first database system I ever worked with. Learned a little bit about tables and queries.

    OK, so now that we're done kicking around useless suggestions that aren't going to help the OP, how about a few that will help?
    Unfortunately I don't think there's a magic button or option you can turn on/off that will trace a program's code for you. Often what most of us have to resort to is rolling out some sort of logging library, and use that at the top of each sub/method/function to write out where we're at, and what certain values are... then afterwards, inspect the log to see what the path was. Within the IDE, you could probably use Debug.Writeline ... I think that works in VB6, I'm not sure.

    If you can get a hold of the VB6 version of MZTools, I think it's got some addins that will add line numbers and some rudimentry logging to your code.. it may not be perfect, but it might help get things rolling.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  9. #9
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by techgnome View Post
    As long as we're kicking around useless suggestion, in BASIC you could use TRON to run traces through a program. Don't think VB has that.
    Incidentally, I cut my teeth on dBase II ... that was the first database system I ever worked with. Learned a little bit about tables and queries.

    OK, so now that we're done kicking around useless suggestions that aren't going to help the OP, how about a few that will help?
    Unfortunately I don't think there's a magic button or option you can turn on/off that will trace a program's code for you. Often what most of us have to resort to is rolling out some sort of logging library, and use that at the top of each sub/method/function to write out where we're at, and what certain values are... then afterwards, inspect the log to see what the path was. Within the IDE, you could probably use Debug.Writeline ... I think that works in VB6, I'm not sure.

    If you can get a hold of the VB6 version of MZTools, I think it's got some addins that will add line numbers and some rudimentry logging to your code.. it may not be perfect, but it might help get things rolling.

    -tg
    I took it the OP wanted individual lines of code in the order they get executed from one routine to another. Almost like a very ,very detailed stack trace.
    Last edited by TysonLPrice; Sep 21st, 2017 at 12:44 PM.
    Please remember next time...elections matter!

  10. #10

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    23

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by techgnome View Post
    As long as we're kicking around useless suggestion, in BASIC you could use TRON to run traces through a program. Don't think VB has that.
    Incidentally, I cut my teeth on dBase II ... that was the first database system I ever worked with. Learned a little bit about tables and queries.

    OK, so now that we're done kicking around useless suggestions that aren't going to help the OP, how about a few that will help?
    Unfortunately I don't think there's a magic button or option you can turn on/off that will trace a program's code for you. Often what most of us have to resort to is rolling out some sort of logging library, and use that at the top of each sub/method/function to write out where we're at, and what certain values are... then afterwards, inspect the log to see what the path was. Within the IDE, you could probably use Debug.Writeline ... I think that works in VB6, I'm not sure.

    If you can get a hold of the VB6 version of MZTools, I think it's got some addins that will add line numbers and some rudimentry logging to your code.. it may not be perfect, but it might help get things rolling.

    -tg
    I have mztools and it is worth the $63.00 for just 1 or 2 of it many many features.
    I sent an email to the author and awaiting a reply.
    I am in shock that such a useful feature is not available on some add on.
    It just may be that is is impossible to do within the confines of vb6.
    Hopefully someone will have an answer for me.

  11. #11
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Printed trail of each statement a vb6 program goes through.

    www

    Do you need an actual printout?
    How many lines of code do you expect to be involved?

    If it is more a matter of debugging, would it be sufficient to just put a break-point at the beginning of the command button sub and just repeatedly press F8 to visually follow the code?

    Spoo

  12. #12
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by TysonLPrice View Post
    I took it the OP wanted individual lines of code in the order they get executed from one routine to another. Almost like a very ,very detailed stack trace.
    oooooh.... yeah, I don't think anything will do that... the closest you're going to get is something that spits out "I'm here!" ... "Now I'm here!" ... can't begin to count the number of times I've riddled my code with Foo's and Bar's.
    in an attempt to figure out where the fork something was going wroing.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  13. #13
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: Printed trail of each statement a vb6 program goes through.

    The closest you can have in VB6 is this:

    Hit the F8 key and keep it pressed down.
    You'll have the lines executed one by one and highlighted with yellow background the one that is executing.

    When you get tired (or you already discovered the bug) press F5.

  14. #14
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: Printed trail of each statement a vb6 program goes through.

    CodeSmart seems to capable of doing this:
    3.2. Code Flow Explorer and Designer Explorer
    If the expanded Code Flow folder area inside the Project Explorer is not enough then you can always use the dedicated Code Flow Explorer, plus the information is much more complete here. By using the 'Code Flow - Options' dialog, you can configure which code constructs you are interested in seeing in the tree.
    http://www.axtools.com/products-codesmart-vb6.php#T2

  15. #15
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by Arnoutdv View Post
    CodeSmart seems to capable of doing this:

    http://www.axtools.com/products-codesmart-vb6.php#T2
    He wants to see each line that is executed while the code is running.

  16. #16
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: Printed trail of each statement a vb6 program goes through.

    I interpreted it as seeing the code flow starting from a certain piece of code.

  17. #17
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by Eduardo- View Post
    He wants to see each line that is executed while the code is running.
    I thought he wanted some kind of document.

    print out a list of the statements a program goes through when I press a certain command button.
    Please remember next time...elections matter!

  18. #18
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: Printed trail of each statement a vb6 program goes through.

    Same thoughts here, but you worded it better
    Last edited by Arnoutdv; Sep 22nd, 2017 at 06:44 AM.

  19. #19
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by Arnoutdv View Post
    I interpreted it as seeing the code flow starting from a certain piece of code.
    For that he has F9. (sets a breakpoint on that line)

  20. #20
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by TysonLPrice View Post
    I thought he wanted some kind of document.
    print out a list of the statements a program goes through when I press a certain command button.
    Quote Originally Posted by wwwursa View Post
    i HAVE A VERY COMPLEX VB6 PROGRAM.
    i am looking for a program which will print out a list of the statements a program goes through when I press a certain command button.

    THANK YOU.
    I suppose he wants to debug something.

  21. #21
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by Arnoutdv View Post
    CodeSmart seems to capable of doing this:

    http://www.axtools.com/products-codesmart-vb6.php#T2
    WOW. Looks promising ..

    Eduardo

    FWIW, someone suggested the F8 key in post #11 ..

    Spoo

  22. #22
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by Spooman View Post
    WOW. Looks promising ..

    Eduardo

    FWIW, someone suggested the F8 key in post #11 ..

    Spoo
    Ah, OK, I didn't see it.

  23. #23
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Printed trail of each statement a vb6 program goes through.

    Quote Originally Posted by Eduardo- View Post
    Ah, OK, I didn't see it.
    No probs.
    Besides, your post #13 was better stated than mine was.

    Spoo

  24. #24
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Printed trail of each statement a vb6 program goes through.

    despite all the guesses as to what the op wants, i do not see any suggestion, if this should just be for the ide or if it should log when compiled, or both

    i do not see that what is wanted should be impossible, but i would think it could slowdown program execution, and write large log files, so should be able to be enabled or disabled from within the program and /or command line parameter
    in a large project, the # of code lines in the project may also become a problem
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  25. #25
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Printed trail of each statement a vb6 program goes through.

    Pete

    Program slowdown, I'd guess, is not an issue, as this would essentially be a 1-time debugging effort.
    Unless you are referring to the # of code lines needed that would still affect performance if disabled.

    BTAIM, what would you suggest would be said lines of code that could produce the log?

    Spoo

  26. #26
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,055

    Re: Printed trail of each statement a vb6 program goes through.

    [...]
    Last edited by dz32; Apr 26th, 2019 at 11:29 AM.

  27. #27
    Fanatic Member
    Join Date
    Apr 2015
    Location
    Finland
    Posts
    679

    Re: Printed trail of each statement a vb6 program goes through.

    Finnish company Aivosto (means brains in english) has Project analyzer and VB Watch products.
    http://www.aivosto.com/vbwatch.html

    I'm not affiliated to that company.

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