Results 1 to 25 of 25

Thread: Viewing two pieces of code side by side

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Viewing two pieces of code side by side

    Can I look at two subs side by side in VB6.

    I want to do a line by line compare


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,039

    Re: Viewing two pieces of code side by side

    The code is text. There are a variety of text comparison tools out there, so you can probably find a free one that you like which will show you the differences between A and B. Aside from that, you may not have any alternative in VB6. If you can open two versions of VB6 simultaneously, you could open one sub in one version and the other sub in another version, then you could put them side by side.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Viewing two pieces of code side by side

    Yeah, I know about using two of the same projects.

    Right now I copy Sub2 to a new BAS module then compare Sub1 in the original module to Sub2 in the new module, make whatever changes need to be made then copy Sub2 back to it's original location and delete the one in the new module.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Viewing two pieces of code side by side

    I thought WINDIFF.exe was part of the VS install - I've always had it around and use it quite frequently. It compares two text files (or two folders of text files) and displays the differences very nicely.

    Actually - I just looked on an old XP machine and it's part of the Microsoft SDK for v6.0A

    And it appears to be available for Win 7 and later here

    http://www.microsoft.com/en-us/downl...s.aspx?id=7911
    Last edited by szlamany; Apr 6th, 2014 at 09:03 AM.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Viewing two pieces of code side by side

    Thread moved from 'Chit-Chat' to the 'General Developer' forum.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Viewing two pieces of code side by side

    Quote Originally Posted by szlamany View Post
    I thought WINDIFF.exe was part of the VS install - I've always had it around and use it quite frequently. It compares two text files (or two folders of text files) and displays the differences very nicely.
    I'm looking for way to see two subs side by side manually. There will be many differences which are OK; but I need to see if each sub has the same processing methods even though names will be different. For example one Sub is called ProcessWhite and the other Sub is ProcessBlack. They both have to do the same thing with the same methods and API calls and whatever but each Sub will refer to the objects and arguments as white and black (ie WhitePiece, BlackPiece, Call GetWhiteInfo, Call GetBlackInfo, etc)


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Viewing two pieces of code side by side

    The code windows have a splitter that allows you two have two views of the same module, but they are arranged "over and under" rather than "side by side."

    Until wide aspect ratio monitors came along "side by side" didn't make much sense. This is probably why older tools like WinDiff don't have such a mode either.


    If you want to do this and can consider using another text editor for it you might look at:

    Managing two views in a single Notepad++ instance

  8. #8
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Viewing two pieces of code side by side

    Quote Originally Posted by jmsrickland View Post
    I'm looking for way to see two subs side by side manually. There will be many differences which are OK; but I need to see if each sub has the same processing methods even though names will be different. For example one Sub is called ProcessWhite and the other Sub is ProcessBlack. They both have to do the same thing with the same methods and API calls and whatever but each Sub will refer to the objects and arguments as white and black (ie WhitePiece, BlackPiece, Call GetWhiteInfo, Call GetBlackInfo, etc)
    That is exactly what WINDIFF does - it compares two files and shows similarities in WHITE text and differences in RED (old file or file on the LEFT) and YELLOW (new file or file on the RIGHT). And a HUGE summary GRAPH on the far left - it's very comprehensive (although not as good as the DIFF utility from my mainframe VAX/VMS days).
    Attached Images Attached Images  

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Viewing two pieces of code side by side

    Er, DEC's VAX product line was not mainframes but minicomputers.

  10. #10
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Viewing two pieces of code side by side

    Yeah - I know that - I worked that line since I was 17 years old. I figure most folks here would not know what a minicomputer was. Obviously you are old enough.

    Er? Do you make that noise often? I'm glad I'm not in your actual presence!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  11. #11
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Viewing two pieces of code side by side

    omg - I just logged into a VAX right now? Do I use my minicomputer or mainframe commands? Oh - I don't remember - better ask Dilettante!

    Code:
            Welcome to VAX/VMS V7.2
    
    Username: antares
    Password:
     Welcome to OpenVMS (TM) VAX Operating System, Version V7.2
        Last interactive login on Sunday,  6-APR-2014 20:16
        Last non-interactive login on Friday,  2-NOV-2007 10:29
    
    $ help dif
    
    DIFFERENCES
    
         Compares the contents of two disk files and displays a listing of
         the records that do not match.
    
         Format
    
           DIFFERENCES  input1-filespec [input2-filespec]
    
    
    
    
      Additional information available:
    
      Parameters Qualifiers
      /CHANGE_BAR           /COMMENT_DELIMITER    /EXACT     /HIGHLIGHT /IGNORE
      /MATCH     /MAXIMUM_DIFFERENCES  /MERGED    /MODE      /NUMBER    /OUTPUT
      /PAGE      /PARALLEL  /SEARCH    /SEPARATED /SLP       /WIDTH     /WINDOW
      /WRAP
      Examples
    
    DIFFERENCES Subtopic?
    There's that DIFF command - look at all those powerful parameters to control the output and functionality!

    Quote Originally Posted by dilettante View Post
    ...This is probably why older tools like WinDiff don't have such a mode either.
    I guess I can handle these older tools - WINDIFF included!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  12. #12
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Viewing two pieces of code side by side

    Don't tell Dill - some VAX's were MAINFRAMES!!

    http://en.wikipedia.org/wiki/VAX

    The VAX went through many different implementations. The original VAX 11/780 was implemented in TTL and filled a four-by-five-foot cabinet[6] with a single CPU. CPU implementations that consisted of multiple ECL gate array or macrocell array chips included the VAX 8600 and 8800 superminis and finally the VAX 9000 mainframe class machines
    I'm so glad Dill pointed out his superior knowledge of dead equipment!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  13. #13
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Viewing two pieces of code side by side

    Some of us spent major portions of our careers working with large machines, many of them dwarfing even the largest VAX 9000 ever shipped.

    It is too bad some people have no experience with actual big iron. And far from "dead" you might be surprised at how much mainframes are still in use today.

  14. #14
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Viewing two pieces of code side by side

    At least I proposed a solution rather than failing to read the original question which asked for "side by side."

  15. #15
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Viewing two pieces of code side by side

    Not only side by side, but two subs in the same file.
    Most every Diff I know of requires two files, which the OP says is what he has to do currently. Copy the sub to a new file, compare the two files, make the changes to the sub, and copy it back to the original file.
    The point was whether there is a mechanism to look a two subs side by side, not two files, in order to eliminate the need to create a second file just for comparisons.

    Open VMS 7.2... That might actually be a "MicroVAX", correct?
    And regardless of size of machine, I don't think I worried about MainFrame commands, or Minicomputer commands, it was the operating system (i.e. VMS commands) or even the shell (i.e. DCL commands) that you deal with.
    Haven't worked with VAXs in quite a while, but it was quite nice when when we got a MicroVaxII to do some development with, as a compile on the VAX-11/785 that took 15 minutes, would compile in about 20 seconds on the MicroVax. Before that we had a PDP-11/34 and I used to do the compiles on third shift for the software engineers and we generally only build one load a day, as it took several hours to build (compile and link) several of the projects that made up a Simulation load, so my DEC period extended from 4 hours to build a particular big program on the PDP to 15 minutes on the VAX-785 to 20 seconds on the MicroVAX. Took awhile to warmup to Unix after doing DEC VMS for 8 years or so.

  16. #16
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Viewing two pieces of code side by side

    I also took a look around but I didn't find any IDE add-in permitting two open code windows on the same module. With that he could tile them side by side.

  17. #17
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,902

    Re: Viewing two pieces of code side by side

    but two subs in the same file
    Yes, that does seem to be the bit everyone's missing.

    To be honest, if that's what you want to do I can't see what's wrong with Shaggy's suggestion. Just open two IDE's. As long as you're making the changes in one IDE only that should be a fairly straight forward solution to the problem.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  18. #18
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Viewing two pieces of code side by side

    This is a picture of the last VAX I owned - wish I still had it - Yale University is asking for donations of old hardware and other IT stuff for a museum they are creating.

    From this post 8 years ago

    http://www.vbforums.com/showthread.p...=1#post2307685

    I bought that VAX from Park Street church - one of the oldest churches in Boston. The node name was PSCVAX - I didn't feel quite right changing it

    That's a MICROVAX 3400 on the floor - with a green-screen (actually amber) VT220 console on top...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  19. #19
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: Viewing two pieces of code side by side

    If they are in the same file, you can use the split view... I think it got mentioned early on... it splits the view into a top/bottom view... I've used it for the same thing, to compare to pieces or when I'm working in an exceptionally long sub and need something at opposite ends. You activate it by going just above the up button in the scroll bar... you'll get the horizontal split cursor when you're over it, click and hold it, then it works just like a splitter... you can make it as big or as small as you want. When done, resize the split so that the top disappears.

    -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??? *

  20. #20
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Viewing two pieces of code side by side

    Quote Originally Posted by FunkyDexter View Post
    ...
    To be honest, if that's what you want to do I can't see what's wrong with Shaggy's suggestion. Just open two IDE's. As long as you're making the changes in one IDE only that should be a fairly straight forward solution to the problem.
    The OP said he was using VB6.
    VB6 doesn't allow opening the same project in a second IDE session (which Shaggy gave the disclaimer "If you can open two versions of the VB6 IDE simultaneously...").
    You can open multiple VB6 sessions, just not on the same project.

  21. #21
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,039

    Re: Viewing two pieces of code side by side

    Yeah, my memory of VB6 is fading. Of course, in .NET, it would be easier due to advances in the IDE itself. I just forget what was and was not added to the IDE in various versions. Now that people mention it, I do remember using that over/under comparison a few times. It really sucked on rectangular monitors too, unless you had the lettuce for a large monitor. Back in those days, people were often still running 640x480, or possibly 800x600, neither of which had enough screen real estate to do much of a comparison.

    As for the debate about whether a VAX was a mainframe or a minicomputer, I could ask my father, as he was a DEC engineer in those days and would probably explain the nuances in great detail. He'd give you just the VAX.

    On the other hand, we could put it to a vote by going around asking people about it. It might be considered a Vax populi.
    My usual boring signature: Nothing

  22. #22
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    Re: Viewing two pieces of code side by side

    I had a ZX81 mainframe, once...
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  23. #23
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Viewing two pieces of code side by side

    What about Beyond Compare? I think it is up to version 3 if not 4.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  24. #24
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Viewing two pieces of code side by side

    As far as I can tell, Beyond Compare still requires two text files to compare against, it won't allow you to compare two subs in the same file against each other. The OP is currently having to copy the one sub to another file temporarily in order to do the compare, and was asking if there was a way to view (and compare) two subs against each other without having to copy code to another file.

  25. #25
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Viewing two pieces of code side by side

    This PHP tool allows you compare something in the EDITOR to the clipboard.

    http://www.jetbrains.com/phpstorm/we...ing-files.html

    This one does it with VS2010 and up - not VB6 unfortunately.

    http://comparisontools.codeplex.com/

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

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