Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » Utilities » Revisions

Visual FoxPro Lines of Code Analysis

By , 29 May 2007
Rate this:
Please Sign up or sign in to vote.
This is an old version of the currently published article.


Being a long-time Visual FoxPro turned .NET developer, I am now faced with the task of porting several existing applications from VFP to .NET - and providing customers with estimates of effort for each project as well.

Since I could not find a Source Lines of Code (SLOC) tool for VFP projects, I decided to build one. This article is the result of my work and I hope someone else will find this tool useful in their work.

Using the Application

The VFPLOCCounter application is very easy to use - simply select the VFP *.pjx file you wish to analyze and then click the Process button.

The application will analyze code found in Forms (*.scx), Menus (*.mnx), Class Libraries (*.vcx), Programs (*.prg), Includes (*.h), and Reports (*.frx).

For each file, the application generates the following metrics:

  • Total number of lines of source
  • Number of methods
  • Number of lines of Code
  • Number of Comment lines
  • Number of Blank lines
  • Percentage of Code lines
  • Percentage of Comment lines
  • Percentage of Blank lines

Note the Percentage calculations are all based on the total lines in the file or project, for example, the Percentage of Code lines is calculated as follows:

fileCodePercent = (fileCodeLines / fileTotalLines) * 100;

After all files in the project have been analyzed, the application generates the above metrics for the project as a whole.

When the analysis is completed, you can produce a printable report by clicking the Print Preview button which is positioned to the right of the Process button.

Points of Interest

The report that the application generates is built using Microsoft Reporting and was for me an interesting excursion into this way of building reports.



  • 29th May, 2007: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Mark Miller
Software Developer (Senior)
United States United States
I develop software for a leading healthcare system in Northern Illinois.

Comments and Discussions

Discussions posted for the Published version of this article. Posting a message here will take you to the publicly available article in order to continue your conversation in public.
QuestionDatabase Stored Procedure not analysed PinmemberMember 818889431-Aug-11 10:23 
QuestionIt's not working for all files PinmemberMember 818891631-Aug-11 6:32 
AnswerRe: It's not working for all files PinmemberMark Miller31-Aug-11 7:03 
GeneralRe: It's not working for all files PinmemberMember 818891631-Aug-11 10:17 
GeneralRe: It's not working for all files PinmemberMember 818889431-Aug-11 10:30 
GeneralRe: It's not working for all files PinmemberMark Miller31-Aug-11 17:56 
GeneralJIT Depuration Pinmembersantimaza9-Jun-11 1:17 
GeneralRe: JIT Depuration PinmemberMark Miller9-Jun-11 7:03 
Generalvfp lines of code counter PinmemberMike Poirier18-Dec-09 3:50 
GeneralRe: vfp lines of code counter PinmemberMark Miller21-Dec-09 9:28 
Generalfoxpro project books Pinmembermicrocomputershisar2-Dec-08 20:22 
GeneralRe: foxpro project books PinmemberMark Miller3-Dec-08 4:51 
QuestionDoes it work for Memo fields? PinmemberAndrey Chekh30-Oct-07 10:51 
GeneralVery Well Done PinmemberSteveC-A95-Jun-07 7:43 
GeneralRe: Very Well Done PinmemberMark Miller5-Jun-07 9:24 
GeneralCorrections PinmemberAlexke4-Jun-07 22:24 
GeneralRe: Corrections PinmemberMark Miller5-Jun-07 4:41 
GeneralMigration Lines of Code Counter Pinmemberrajantawate1(http// 8:52 
GeneralRe: Migration Lines of Code Counter PinmemberMark Miller29-May-07 9:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 29 May 2007
Article Copyright 2007 by Mark Miller
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid