Count Lines of Code and Search for a String in a VB Project

Files and Directories
John Conwell

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This tool has two bits of functionality. The first one counts the lines of code in your app. I know VSS will do this for you, but it only counts the lines of code for one file at a time, so if you have an app with 20 files then that can get pretty anoying. Also, VSS will count all the metadata that defines the controls on a .frm file (open a .frm in notepad to see what i mean). This will give a false sense of the coding effert that went into the app. This tool gives counts all the code in .frm, .bas, .cls, .dsr and .ctl files (its easy to add a new file type if i missed one) for an application. It also breaks down the line count into number of blank lines, number of commented lines, number of lines with actual code and a total of all three.

The second one is a string search procedure to search vb files for a specific text string. This is useful if you have, like me, a code library of about 40 apps and need to find a code example that you remember you did about 6 months ago, but can't remember what project it was in.

This tool uses the file system object to do the majority of file manipulation. One thing to keep in mind, MS broke interface of the file system object dll (scrrun.dll) when they made IE 5.0 so if your running an IE version less than 5.0 you will probably have to recompile the exe before it will work because i compiled it against the new interface.

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.