I often find myself comment out big sections of code that worked before, keeping them intact. I then modify a copy of that section of code to version 2, 3, etc... This is how I usually do in C with /* */. This way I have a record and with a quick look I can see what has changed.
Unfortunately this methods leaves multiple versions of front panel objects with which the code had been commented. I am also less inclined to save a new VIs for each version, seems too much work...
What is the best way to achieve this purpose ?
You might wanna try Diagram Disable Structure. Then you can copy you code in that structure, and it will not be seen on the frontpanel
The diagram disable structure does not hide front panel controls. And code is never seen on the front panel because it only exists on the block diagram.
If you need to hide disabled controls, you will have to hide them from the front panel. Another choice would be to move them off screen.
If the control is shared among the different versions, you can try moving it outside the disable structure, so that it's shared.
A more general answer is that you should probably use source code control (SVN is free and easy to understand, but there are others). That gives you a backup, allows you to maintain a full history and allows multiple people to work on code. You can configure your SCC provider to work with the LV diff tool, which will then allow seeing the changes between different versions of the same VI.
Thanks all, I am aware of above solutions and it seems there is no nice workaround. Perhaps NI should auto hide the front panels objects if they happen to be in the Diagram disable structure. It makes no sense they should appear on the front panel when the control/indicators themselves on block diagram are disabled.
Sounds like you should be using source control (which is even more true in text based languages as well)! Make a change, commit to source control and add a note saying what you changed and then you can can easily look back through the history of a VI without needing to add lots of dead (un-executed) code. If you use a server (e.g. an online repository or a network server) then you get the added bonus that all your code is backed up too!
Here are a few ideas that touch this subject: