Line Counting

This morning I was curious as to how many actual, real lines of code there were in my company’s product. So, being the geek that I am, I wrote a program to find out. And because I like to share, I’m making the program available here.

This is a Visual Basic 6.0 program; so be sure to have the necessary VB runtimes installed on your system before you try to run it. Obviously, as well, this will only run on Windows PCs… sorry Mac & Linux people!

The program allows you to select a single VB project file, which it will then parse for all of its component files. It will then count the lines of code (non-blank, non-comment) in the files & add it up and give it to you as a total. You can check off the box to keep a running total of all lines in several projects; but VB is limited (without some fancy libraries that I was too lazy to include) to integers of something in the neighborhood of 36,000 – if your projects have more lines then that, you’ll get a run-time error 6 – overflow error, and the program will crash. (No, there’s no error checking – it was a quick & dirty utility for my use!)

Anyway, feel free to use if it you want. And in case you were wondering… my program currently has 72,145 lines of code. YIKES!

Published
Categorized as tech

By Keith Survell

Geek, professional programmer, amateur photographer, crazy rabbit guy, only slightly obsessed with cute things.