Visual FoxPro is a
Microsoft
Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washi ...
data-centric procedural programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming ...
with
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
(OOP) features.
It was derived from
FoxPro
FoxPro was a text-based (computing), text-based Procedural programming, procedurally oriented programming language and database management system (DBMS), and it was also an object-oriented programming language, originally published by Fox Softwa ...
(originally known as FoxBASE) which was developed by Fox Software beginning in 1984. Fox Technologies merged with Microsoft in 1992, after which the software acquired further features and the prefix "Visual".
FoxPro 2.6 worked on
Mac OS
Two major famlies of Mac operating systems were developed by Apple Inc.
In 1984, Apple debuted the operating system that is now known as the "Classic" Mac OS with its release of the original Macintosh System Software. The system, rebranded "M ...
,
DOS
DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems.
DOS may also refer to:
Computing
* Data over signalling (DoS), multiplexing data onto a signalling channel
* Denial-of-service attack (DoS), an attack on a communicat ...
,
Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for se ...
, and
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, ...
.
Visual FoxPro 3.0, the first "Visual" version, reduced platform support to only Mac and Windows, and later versions 5, 6, 7, 8 and 9 were Windows-only. The current version of Visual FoxPro is
COM
Com or COM may refer to:
Computing
* COM (hardware interface), a serial port interface on IBM PC-compatible computers
* COM file, or .com file, short for "command", a file extension for an executable file in MS-DOS
* .com, an Internet top-level d ...
-based and Microsoft has stated that they do not intend to create a
Microsoft .NET
The Microsoft .NET strategy is a marketing plan that Microsoft followed in the early 2000s. Steve Ballmer described it as the company's "most ambitious undertaking since Internet Strategy Day in 1995". In support of this strategy, between 2000 and ...
version.
Version 9.0, released in December 2004 and updated in October 2007 with the SP2 patch, was the final version of the product.
History
Visual FoxPro originated as a member of the class of languages commonly referred to as "
xBase
xBase is the generic term for all programming languages that derive from the original dBASE ( Ashton-Tate) programming language and database formats. These are sometimes informally known as dBASE "clones". While there was a non-commercial pred ...
" languages, which have syntax based on the
dBase
dBase (also stylized dBASE) was one of the first database management systems for microcomputers and the most successful in its day. The dBase system includes the core database engine, a query system, a forms engine, and a programming language ...
programming language. Other members of the xBase language family include
Clipper
A clipper was a type of mid-19th-century merchant sailing vessel, designed for speed. Clippers were generally narrow for their length, small by later 19th century standards, could carry limited bulk freight, and had a large total sail area. "Cl ...
and Recital (database).
Visual FoxPro, commonly abbreviated as VFP, is tightly integrated with its own relational database engine, which extends FoxPro's xBase capabilities to support
SQL query and data manipulation. Unlike most
database management systems, Visual FoxPro is a full-featured,
dynamic programming language that does not require the use of an additional general-purpose programming environment. It can be used to write not just traditional "
fat client" applications, but also
middleware
Middleware is a type of computer software that provides services to software applications beyond those available from the operating system. It can be described as "software glue".
Middleware makes it easier for software developers to implement ...
and
web application
A web application (or web app) is application software that is accessed using a web browser. Web applications are delivered on the World Wide Web to users with an active network connection.
History
In earlier computing models like client-serv ...
s.
In late 2002, it was demonstrated that Visual FoxPro can run on
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
under the
Wine
Wine is an alcoholic drink typically made from Fermentation in winemaking, fermented grapes. Yeast in winemaking, Yeast consumes the sugar in the grapes and converts it to ethanol and carbon dioxide, releasing heat in the process. Different ...
Windows compatibility suite. In 2003, this led to complaints by Microsoft: it was claimed that the deployment of runtime FoxPro code on non-Windows machines violates the
End User License Agreement.
Visual FoxPro had a rapid rise and fall in popularity as measured by the
TIOBE Programming Community Index. In December 2005, VFP broke into the top 20 for the first time. In June 2006 it peaked at position 12, making it (at the time) a "B" language. As of October 2019, Visual FoxPro holds position 51 on the TIOBE index.
In March 2007, Microsoft announced that there would be no VFP 10,
[A Message to the Community](_blank)
/ref> thus making VFP9 (released to manufacturing on December 17, 2004) the last commercial VFP release from Microsoft. Service Pack 2 for Microsoft Visual FoxPro 9.0 was released on October 16, 2007. The support of Version 9 ended on January 13, 2015.
At the time of the end of life announcement, work on the next release codenamed Sedna (named after a recently discovered dwarf planet) which was built on top of the VFP9 codebase had already begun. "Sedna" is a set of add-ons to VFP 9.0 of xBase components to support a number of interoperability scenarios with various Microsoft technologies including SQL Server 2005, .NET Framework
The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
, Windows Vista, Office 2007, Windows Search and Team Foundation Server
Azure DevOps Server (formerly Team Foundation Server (TFS) and Visual Studio Team System (VSTS)) is a Microsoft product that provides version control (either with Team Foundation Version Control (TFVC) or Git), reporting, requirements managemen ...
(TFS). Microsoft released Sedna under the Shared source
The Shared Source Initiative (SSI) is a source-available software licensing scheme launched by Microsoft in May 2001. The program includes a spectrum of technologies and licenses, and most of its source code offerings are available for download aft ...
license on the CodePlex
CodePlex was a forge website by Microsoft. While it was active, it allowed shared development of open-source software.
Its features included wiki pages, source control based on Mercurial, TFVC, Subversion or Git, discussion forums, issue trac ...
site. Microsoft has clarified that the VFP core will still remain closed source. Sedna was released on January 25, 2008. As of March 2008, all xBase components of the VFP 9 SP2 (including Sedna) were available for community-development on CodePlex.
In late March 2007 a grassroots
A grassroots movement is one that uses the people in a given district, region or community as the basis for a political or economic movement. Grassroots movements and organizations use collective action from the local level to effect change at t ...
campaign was started by the Spanish-speaking FoxPro community at MásFoxPro ("MoreFoxPro" in English
English usually refers to:
* English language
* English people
English may also refer to:
Peoples, culture, and language
* ''English'', an adjective for something of, from, or related to England
** English national ide ...
) to sign a petition to Microsoft to continue updating Visual FoxPro or release it to the community as open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
. On April 3, 2007 the movement was noted by the technical press.[Developers petition Microsoft to reconsider FoxPro phase out](_blank)
Posted by Mary Jo Foley (April 3rd, 2007) - All about Microsoft - ZDNet.com
On April 3, 2007, Microsoft responded to the petition with this statement from Alan Griver:
"We're very aware of the FoxPro community and that played a large part in what we announced on March 13th. It's never an easy decision to announce that we're not going to release another version of a product and it's one that we consider very carefully.
"We're not announcing the end of FoxPro: Obviously, FoxPro applications will continue to work. By some of our internal estimates, there are more applications running in FoxPro 2.6 than there are in VFP and FoxPro 2.6 hasn't been supported in many years. Visual FoxPro 9 will be supported by Microsoft through 2015.
"For Microsoft to continue to evolve the FoxPro base, we would need to look at creating a 64-bit development environment and that would involve an almost complete rewrite of the core product. We've also invested in creating a scalable database with SQL Server, including the freely available SQL Server Express Edition. As far as forming a partnership with a third-party is concerned, we've heard from a number of large FoxPro customers that this would make it impossible for them to continue to use FoxPro since it would no longer be from an approved vendor. We felt that putting the environment into open source on CodePlex
CodePlex was a forge website by Microsoft. While it was active, it allowed shared development of open-source software.
Its features included wiki pages, source control based on Mercurial, TFVC, Subversion or Git, discussion forums, issue trac ...
, which balances the needs of both the community and the large customers, was the best path forward."
Version Timeline
All versions listed are for Windows.
Code samples
The FoxPro language contains commands quite similar to other programming languages such as Basic.
Some basic syntax samples:
FOR i = 1 to 10
x = x + 6.5
NEXT && Instead of "NEXT" can also use "ENDFOR"
IF i = 25
i = i + 1
ELSE
i = i + 3
ENDIF
x = 1
DO WHILE x < 50
x = x + 1
ENDDO
x = 1
DO WHILE .T.
x = x + 1
IF x < 50
LOOP
ELSE
EXIT
ENDIF
ENDDO
nMonth = MONTH(DATE())
DO CASE
CASE nMonth <= 3
MESSAGEBOX("Q1")
CASE nMonth <= 6
MESSAGEBOX("Q2")
CASE nMonth <= 9
MESSAGEBOX("Q3")
OTHERWISE
MESSAGEBOX("Q4")
ENDCASE
FOR EACH oControl IN THISFORM.Controls
MESSAGEBOX(oControl.Name)
ENDFOR
f = Factorial(10)
FUNCTION Factorial(n)
LOCAL i, r
r = 1
FOR i = n TO 1 STEP -1
r = r * i
NEXT && Can also use "ENDFOR" here instead of "NEXT"
RETURN r
ENDFUNC
Hello World examples:
* Output at the current location
? "Hello World"
* Output at a specified location
@ 1,1 SAY "Hello World"
* Output in a separate window, cleared on input
WAIT WINDOW "Hello World"
* Output in a standard dialog box, cleared on OK
MESSAGEBOX("Hello World")
Object
* Output in a defined window
loForm = CREATEOBJECT("HiForm")
loForm.Show(1)
DEFINE CLASS HiForm AS Form
AutoCenter = .T.
Caption = "Hello, World"
ADD OBJECT lblHi as Label ;
WITH Caption = "Hello, World!"
ENDDEFINE
loMine = CREATEOBJECT("MyClass")
? loMine.cProp1 && This will work. (Double-ampersand marks an end-of-line comment)
? loMine.cProp2 && Program Error: Property CPROP2 is not found because it's hidden externally.
? loMine.MyMethod1() && This will work.
? loMine.MyMethod2() && Program Error: Property MYMETHOD2 is not found because it's hidden externally.
DEFINE CLASS MyClass AS Custom
cProp1 = "My Property" && This is a public property
HIDDEN cProp2 && This is a private (hidden) property
dProp3 = && Another public property
PROCEDURE Init() && Class constructor
This.cProp2 = "This is a hidden property."
PROCEDURE dProp3_Access && Property Getter
RETURN DATE()
PROCEDURE dProp3_Assign(vNewVal) && Property Setter uses the "_assign" tag on the property name
IF VARTYPE(vNewVal) = "D"
THIS.dProp3 = vNewVal
ENDIF
PROCEDURE MyMethod1()
* This is a public method, calling a hidden method that returns
* the value of a hidden property.
RETURN This.MyMethod2()
HIDDEN PROCEDURE MyMethod2() && This is a private (hidden) method
RETURN This.cProp2
ENDDEFINE
* VFP has an extensive library of predefined classes and visual objects which are accessed in the IDE by a Property Sheet (including Methods
Method ( grc, μέθοδος, methodos) literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In recent centuries it more often means a prescribed process for completing a task. It may refer to:
*Scien ...
), so code such as the above defining classes and objects are only needed for special purposes and the framework
A framework is a generic term commonly referring to an essential supporting structure which other things are built on top of.
Framework may refer to:
Computing
* Application framework, used to implement the structure of an application for an op ...
of large systems.
Data handling
The language also has extensive database manipulation and indexing commands.
The "help" index of commands in VFP 9 has several hundred commands and functions described.
The examples below show how to code the creation and indexing of tables, however VFP has table and database builder screens which create the tables and indexes without making you write code.
* Create a table
CREATE TABLE randData (iData I)
* Populate with random data using xBase and SQL DML commands
FOR i = 1 TO 50
APPEND BLANK
REPLACE iData WITH (RAND() * 100)
INSERT INTO randData (iData) VALUES (RAND() * 100)
ENDFOR
* Place a structural index on the data
INDEX ON iData TAG iData
CLOSE DATA && Do not close open libraries etc
* Display ordered data using xBase-style commands
USE randData
SET ORDER TO iData
LOCATE && In place of GO TOP. Enforces use of index to find TOP
LIST NEXT 10 && First 10
GO BOTTOM
SKIP -10
LIST REST && Last 10
CLOSE DATA
* Browse ordered data using SQL DML commands
SELECT * ;
FROM randData ;
ORDER BY iData DESCENDING
ODBC access using SQL passthrough
PRIVATE cAuthorID, cAuthorName && Private variables supplant any previous global or private variable of the same name
LOCAL nHnd, nResult && Local variables are visible only here
* Connect to an ODBC data source
nHnd = SQLCONNECT ("ODBCDSN", "user", "pwd")
* Enter a loop so we can exit to the close connection code if there's an error
DO WHILE .T.
* Execute a SQL command
nResult = SQLEXEC (nHnd, "USE master")
IF nResult < 0
MESSAGEBOX ("MASTER database does not exist!")
EXIT && To close the connection
ENDIF
* Retrieve data from the remote server and stores it in a local data cursor
nResult = SQLEXEC (nHnd, "SELECT * FROM authors", "QAUTHORS")
IF nResult < 0
MESSAGEBOX ("Unable to execute remote SQL SELECT command!")
EXIT && To close the connection
ENDIF
* Update a record in a remote table using parameters
cAuthorID = "1001"
cAuthorName = "New name"
nResult = SQLEXEC (nHnd, "UPDATE authors SET auth_name = ?cAuthorName WHERE auth_id = ?cAuthorID")
IF nResult < 0
MESSAGEBOX ("Unable to execute remote SQL UPDATE command!")
EXIT && To close the connection
ENDIF
* If we get here, we have retrieved everything successfully
EXIT && Exit unconditionally
ENDDO
* Close the connection
SQLDISCONNECT(nHnd)
See also
* Visual Objects Visual Objects is an object-oriented computer programming language that is used to create computer programs that operate primarily under Windows. Although it can be used as a general-purpose programming tool, it is almost exclusively used to create ...
* Xbase++
* Harbour
A harbor (American English), harbour (British English; see spelling differences), or haven is a sheltered body of water where ships, boats, and barges can be docked. The term ''harbor'' is often used interchangeably with ''port'', which is a ...
*XSharp
X#, pronounced X sharp and often written XSharp, is an xBase-compatible programming language for the Microsoft .NET platform. X# has been built on top of Roslyn, the open source architecture behind the current Microsoft C# and Visual Basic .N ...
References
External links
Microsoft pages
Main Visual FoxPro Microsoft page
MSDN FoxPro support board
VFP's online help
Other pages
Visual FoxPro Wiki
A repository of FoxPro information (written in VFP)
A site devoted to the history of FoxPro
VFPx
A Visual FoxPro Community effort to create open source add-ons for VFP 9.0
{{MS DevTools
Programming languages
Fourth-generation programming languages
Data-centric programming languages
Object-oriented programming languages
XBase programming language family
Procedural programming languages
Desktop database application development tools
Microsoft development tools
Microsoft database software
Microsoft programming languages
Programming languages created in 1984
Discontinued Microsoft development tools
High-level programming languages
1984 software
Multi-paradigm programming languages
Discontinued Microsoft software