devxlogo

The Visual FoxPro Toolkit for .NET

The Visual FoxPro Toolkit for .NET

evelopers tend to be proud of their skills with a particular programming tool. This is particularly true with Visual FoxPro and Visual Basic developers. Visual FoxPro (VFP) developers are proud of their language’s strong data access and string handling capabilities while Visual Basic developers are proud of their language’s support of most advanced Windows technologies. (See Sidebar: Authors and Support)

Visual Studio .NET is the great equalizer, though. Now, both camps suddenly find themselves staring at not one, but two new languages, both equally important and very much foreign to all. While VB developers have a little head start with VB.NET, there’s still quite a learning curve. And, as most Visual Studio developers know, VFP is not part of the new Visual Studio .NET platform. While there are a number of reasons behind this (which we will not go into), and while Microsoft has stated that it will continue to support VFP, .NET is here to stay. Many old “FoxFolk,” like myself, are more than a bit curious as to what Visual Studio .NET offers, but are not too keen on giving up some of the great functionality inherent in VFP.

Fast Facts
The new VFP Toolkit for .NET provides 225 Visual FoxPro-equivalent functions for both VB.NET and C#. These not only make the transition to either language easier for VFP developers, but they also add a lot of functionality for those already familiar with Visual Studio .NET. (See Sidebar: More .NET Resources for VFP Developers)

A set of classes is now available that not only help VFP developers get up to speed with .NET, but will also prove very useful for VB.NET and C# developers as well.

Fortunately, a set of classes is now available that not only helps VFP developers get up to speed with .NET, but also proves very useful for VB.NET and C# developers as well. The “VFP Toolkit for .NET,” which you can download for free from GotDotNet, has 225 different functions for array handling, string manipulation, data and other operations. These functions use the same syntax as the native VFP functions. For Fox developers, this is a great tool! Steve Sawyer, a well-recognized Fox guru, put it this way, “it’s like training wheels for .NET!” For other developers, though, the toolkit adds considerable functionality to their arsenal of .NET tools without the cost of development and testing. In short, the VFP Toolkit is for everyone.What’s in the VFP Toolkit?

This is as complete a toolkit as you could ask for… and did I mention that it is free?

As mentioned, the VFP Toolkit classes consist of many different functions that mimic features in Visual FoxPro. However, these are all written in .NET managed code. The toolkit is comprised of a single DLL of only 56K in size. It is a true .NET assembly, not a COM wrapper for VFP, and does not require VFP to be installed. In addition to the toolkit itself, the source code for both C# and VB.NET is also available. The toolkit ZIP file consists of a .DLL, a CHM help file, an XML dynamic help resource and a batch file for installing the toolkit. This is as complete a toolkit as you could ask for, and the development team is to be commended for the work they put into it.

The toolkit namespace consists of the following classes:

  • Arrays?Functions for manipulating arrays, including resizing, scanning, sorting, etc.
  • Common?One of two “miscellaneous” classes, which includes commonly used functions such as variable typing and value testing.
  • Dates?Various functions for setting and changing data values, including extracting date portions.
  • Dialogs?Functions for using Windows dialogs.
  • Environment?Functions for retrieving system environment information, such as disk space, printer information, window attributes, etc.
  • Files?Functions for the low-level handling of folders and files.
  • Help?The other “miscellaneous” class, including immediate IF and object creation functions.
  • Math?Functions for handling mathematic and number-related operations.
  • Strings?Functions for manipulating strings.
  • VfpData?Functions that simulate many of the VFP data handling features.

Not all of the functions contained in these classes are written totally from scratch. Many simply call the function appropriate to either VB.NET or C# (I call these “redirection” functions). The following table provides an overview of the functions (bold text indicates totally new functions while normal text indicates redirection functions).

Arrays ACopy, ADel, ADir,AFont, AIns, ALen, ALines, APrinters, AScan, ASort
Common Between, CPConvert, CPCurrent, Empty, GetPEM, InList,IsBlank, IsNull, KeyBoard*, NVL, Parameters, PCount, RGB, Type, Vartype
Dates CDOW, CMonth, CTOD, CTOT, Date, DateTime, Day, DMY, DOW,DTOC, DTOS, DTOT, GoMonth, Hour, MDY, Minute, Month, Quarter, Sec, Seconds,Time, TTOC, TTOD, Week, Year
Dialogs GetColor*, GetDir*,GetFile*, GetFont*, GetPict*, GetPrinter*, LocFile*, MessageBox*, PutFile*
Environment CapsLog, DiskSpace,DriveType, GetEnv, ID,InsMode, IsMouse*, NumLock, OS, PrintStatus*, PrtInfo*, Sys, SysMetric*,Version, WBorder*, WDockable*, WFont*, WMaximum*, WMinimum*, WOnTop*, WParent*,WTitle*, WVisible*, _ClipText*, _DblClick
Files AddBS, AGetFile, CurDir, DefaultExt, Directory, DisplayPath, FChSize, FClose, FCreate,FDate, FEOF, FFlush, File, FOpen, ForceExt, ForcePath, FPuts, FRead, FSeek,FTime, FullPath, FWrite, Home*, JustDrive,JustExt, JustFName, JustPath, JustStem
Help CreateObject,CreateObjectEX, Do, DoDefault, EditSource, GetInterface, GetObject, IIF,NewObject, _Screen
Math Abs, ACos, ASin, ATan, Atn2, BitAnd, BitLShift, NitNot, BitOr,BitRShift, BitTest, Ceiling, Cos, DTOR, Exp, Floor, Int, Log, Log10, Max, Min, Mod, MTON, NTOM, Pi, Random, Round, RTOD, Sign, Sin, Sqrt, Tan
Strings AllTrim, Asc, At, AtC, AtCLine, Chr, ChrTran, CreateBinary, FileToStri, GetWordCount, GetWordNum, IsAlpha, IsDigit, IsLower, IsUpper, Left, Len, Lower, LTrim, MemLines, MLine, Occurs, PadC, PadL, PadR, Proper, RAt, RAtLine, Replicate, Right, RTrim, Space, Str, StrExtract, StrToFile, StrTran, Stuff, SubStr, Trim, Upper, Val
VfpData Alias, AppendBlank, BOF, Browse*, Count, CursorToXML, CurVal,Delete, DeleteAll, Deleted, DeleteFor, Descending, EOF, FCount, Field, Filter, Found, IndexSeek, IsReadOnly, Lookup, Order, Recall, RecCount, Seek, Select, Set, SetFilterTo,SetOrderTo, SqlConnect, SqlDisconnect, SqlExecute, SqlStringConnect, XMLToCursor

?* Functions available only for Windows Forms, and not for Web Forms

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist