Вы находитесь на странице: 1из 17

Introduction

Visual basic foxpro:visual basic foxpro a data-centric object-oriented and procedural programming language produced by Microsoft. It is derived from FoxPro (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". The last version of FoxPro (2.6) worked under Mac OS, DOS, Windows, and Unix: Visual FoxPro 3.0, the first "Visual" version, reduced platform support to only Mac and Windows, and later versions were Windows-only. The current version of Visual FoxPro is COM-based and Microsoft has stated that they do not intend to create a Microsoft .NET version.FoxPro originated as a member of the class of languages commonly referred to as "xBase" languages, which have syntax based on the dBaseprogramming language. Other members of the xBase language family include Clipper and Recital. (A history of the early years of xBase can be found in the dBase article.)

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 fullfeatured, dynamic programming language that does not require the use of an additional generalpurpose programming environment. It can be used to write not just traditional "fat client" applications, but also middleware and web applications. In late 2002, it was demonstrated that Visual FoxPro can run on Linux under the Wine 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. In December 2005, VFP broke into the top 20 on Tiobe index for the first time. In March 2007 it was at position 19, making it a "B" language. As of August, 2010, VFP (combined with xBase) is at position 25. In March 2007, Microsoft announced that there will be no VFP 10[3], thus making VFP9 (released to manufacturing on December 17, 2004) the last commercial VFP release from Microsoft. The support of Version 9 is ongoing with service packs that were released December 8, 2005 and October 11, 2007. 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, Windows Vista, Office 2007, Windows Search and Team Foundation Server (TFS). Microsoft released Sedna under the Shared source license on the CodePlex 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 campaign was started by the Spanish-speaking FoxPro community at MasFoxPro (MoreFoxPro in English) to sign a petition to Microsoft to continue updating Visual FoxPro or release it to the community as Open Source. On April 3, 2007 the movement was noted by the technical press Also on April 3, 2007 Microsoft responded to the petitioner's requests 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, which balances the needs of both the community and the large customers, was the best path forward."

Fig. show that visual foxpro.

File Extensions and File Types used by Visual FoxPro:Extension File type ---------------------------------------------.act .app .cdx .dbc .dbf .dct .dcx Documenting Wizard action diagram Generated application Compound index Database Table Database memo Database index

.dll .err .exe .fky .fll .fmt .fpt .frt .frx .fxp .hlp .idx .krt

Windows Dynamic Link Library Compilation error Executable program Macro FoxPro Dynamic Link Library Format File Table memo Report memo Report Compiled program Graphical Help Index, compact index Used in the recreation of a .dbc file NOTE: The .KRT extension is not listed in the online Help.

.lbt .lbx .lst .mem .mnt .mnx .mpr .mpx .ocx .pjt .pjx

Label memo Label Documenting Wizard list Memory variable saveDoslives Menu memo Menu Generated menu program Compiled menu program OLE control Project memo Project

.prg .qpr .qpx .sct .scx .spr .spx .tbk .txt .vct .vcx .vue .win

Program Generated query program Compiled query program Form memo Form Generated Screen Program (previous versions of FoxPro only) Compiled Screen Program (previous versions of FoxPro only) Memo backup Text Visual class library memo Visual class library FoxPro 2.x view Window file

Database:A database is an organized collection of data for one or more purposes, usually in digital form. The data are typically organized to model relevant aspects of reality (for example, the availability of rooms in hotels), in a way that supports processes requiring this information (for example, finding a hotel with vacancies). The term "database" refers both to the way its users view it, and to the logical and physical materialization of its data, content, in files, computer memory, and computer data storage. This definition is very general, and is independent of the technology used. However, not every collection of data is a database; the term database implies that the data is managed to some level of quality (measured in terms of accuracy, availability, usability, and resilience) and this in turn often implies the use of a general-purpose Database management system (DBMS). A general-purpose DBMS is typically a complex software system that meets many usage requirements, and the databases that it maintains are often large and complex.

Table:a table is a set of data elements (values) that is organized using a model of vertical columns (which are identified by their name) and horizontal rows. A table has a specified number of columns, but can have any number of rows. Each row is identified by the values appearing in a particular column subset which has been identified as acandidate key. Table is another term for relations; although there is the difference in that a table is usually a multi-set (bag) of rows whereas a relation is a set and does not allow duplicates. Besides the actual data rows, tables generally have associated with them some meta-information, such as constraints on the table or on the values within particular columns. The data in a table does not have to be physically stored in the database. Views are also relational tables, but their data are calculated at query time. Another example are nicknames, which represent a pointer to a table in another database.

Form:A formatted document containing blank fields that users can fill in with data. With paper forms, it is usually necessary for someone to transfer the data from the paper to a computer database, where the results can then be statistically analyzed. Some OCR systems can do this automatically, but they're generally limited to forms containing just check boxes. They can't handle handwritten text. Electronic forms solve this problem by entirely skipping the paper stage. Instead, the form appears on the user's display screen and the user fills it in by selecting options with a pointing device or typing in text from the computerkeyboard. The data is then sent directly to a forms processing application, which enters the information into a database.

Queries:Choosing parameters from a menu: In this method, the database system presents a list of parameters from which you can choose. This is perhaps the easiest way to pose a query because the menus guide you, but it is also the least flexible. Query by example (QBE): In this method, the system presents a blank record and lets you specify the fields and values that define the query. Query language: Many database systems require you to make requests for information in the form of a stylized query that must be written in a special query language. This is the most complex method because it forces you to learn a specialized language, but it is also the most powerful.

Creating a project
The project file (with a PJX extension, accompanied by its memo file, with a PJT extension) is building block of Visual FoxPro applications. The Project Manager, the visible interface to the project file, allows you to easily access all the files and data that belong to the project, as well as compile programs and "build" the application's executable file. Visual FoxPro allows you to have more than one project open at a time, and files can be shared among projects.

Creating the database:Data is the heart of any database application, and you'll need to think about the data you will be entering into your application and the data you intend to retrieve from it. If you don't have any background in relational database design, you'll want to read further on this subject in the Visual FoxPro documentation. I'll be using examples for a Sandbox business and I'll be including tables for Customers, Materials, Orders, and OrderDetails in the database. Start by opening the Data tab of the Project Manager and clicking the New button (Figure 2.) Choose New Database and name your database Sandbox. This creates the Visual FoxPro Database Container file (DBC), which houses metadata about the tables, including primary keys, referential integrity rules, triggers, and stored procedures. Right click the Database Designer window and choose New Table., then New Table again, and name your table Customers. You'll

see the table designer, shown in Figure 3, where you can enter fields for your table, define indexes, rules, and so on. For the Customers table, add a CustomerID field of type Integer, a Customer field of type Character, width 20, and an Address field of type Character, width 20. Add an ascending index on the Customer field.

Creating a main program:In every Visual FoxPro application, some program, menu, or form must be designated (through the menu) as the Main file, and that is where the application begins. It is simplest to use a program (.PRG file) file for this purpose, and the program itself need not be complicated, as in this example: *!* Call the main form (we'll build this below) DO FORM frmMainForm *!* Tell VFP to wait for the user to do something READ EVENTS *!* The form, and the application, will close with *!* CLEAR EVENTS in the Quit button

To create the program, use the New button on the Project manager, save the program as Main.PRG, and start typing. You'll enjoy Visual FoxPro's syntax colouring, shown in Figure 5, which is customizable to your liking.

Creating a form:Visual FoxPro comes with the standard set of form controls (shown in the toolbar), a set of "oneoff" control classes, and a group of ready-to-use Foundation Classes including mover lists and thermometers. The "one-off" control classes serve an important purpose for the inheritance feature of object-oriented programming. To understand the power of inheritance, imagine that your grandmother goes to the beauty parlour to get her hair styled, and your mother, you, and your daughter all immediately have newly-styled hair. In object-oriented programming, Inheritance in programming means that changes to a parent class affect all child classes below it in the hierarchy. Since the Visual FoxPro base classes can't be modified, it's important to use a set of child classes, which you can modify, as the basis for all you do. Visual FoxPro comes with a ready-made set of these child classes in the _Base.VCX class library. For the purpose of this exercise, however, we'll use the form control classes as they come out of the box. Create frmData using the Project Manager's New button. Right click the frmData and choose Data Environment., select your Customers table from the list, and add it to the data environment. With the table in the form's data environment, you can drag and drop to add controls for the data

to the form. Drag the header of the cursor icon to the form to create a grid, or drag the Fields bar of the cursor icon to create labels and text boxes for the individual fields, shown in Figure 8. At runtime, since the Customers table is in the form's data environment it will open automatically when the form opens. Set the Order property of Customers to Customer in the Properties window to prepare for the rest of the example.

Creating a report:Standard wisdom suggests creating a report and adding tables to its data environment and setting relations among them, then dragging the controls onto the report, much as you created your frmData form. While this approach is easy to begin with, it can create a debugging nightmare for multi-table reports. In truth, the simplest way to create a report begins with an SQL SELECT statement, and once you've learned a little of this "second" programming language, it's easier to To make best use of the FoxPro report writer, use SQL to create a denormalized view or cursor of the exact data you want in your report. Refer to the fields in the cursor as MyField only and not MyCursor.MyField. The Report Writer will run the report from whatever cursor, table, or view is in the currently selected work area. The extra effort of adding the controls to the report individually is well worth the time in exchange for the ease of getting the rest of the report working properly.

Creating a table:Syntax

CREATE TABLE <table-name> ( <column-info> [,<column-info>...] ) [IN DATABASE | AS FREE TABLE]

column-info ::= <column-identifier> <data-type> [<vfp-option>] [<column-constraint>] | <table-constraint> data-type ::= type-name | type-name (integer) | type-name (integer, integer) type-name ::= a supported data type (see Supported Data Types)

column CONSTRAINT NOT NULL | constrai CONSTRAINT MINIMUM <max-column-value> | nt ::= CONSTRAINT MAXIMUM <min-column-value> | CONSTRAINT ERROR MESSAGE <error-message> | DEFAULT <default-column-value> | [CONSTRAINT <index-name>] PRIMARY KEY

Creating a query:Determine the kind of information you need to find and the table or view from which you need to retrieve the data. Select the table or view and the corresponding fields that you want data from. Specify any additional criteria for extracting records from the tables or views. Generate the query and direct the results to an output source.

When you have created a query you want to keep, you can save it by giving it a name. Queries are stored as files with the .qpr extension. You can use different methods to create queries: Use the Query Wizard to guide you through the steps of creating queries. Use the Query Designer to create and customize queries quickly. Use SQL SELECT statements, which offer more powerful and flexible ways to generate queries using code.

Creating a labels:Create a simple label using the Label Wizard. A wizard is the easiest way to start creating a label. You can also install default label definitions, or templates, using the Label Wizard. Create a custom label or modify an existing label using the Label Designer. Label Designer begins the label design process with a blank label layout. The Label Designer and Report Designer are similar in functionality but differ in the default page and paper they use.

You can modify any label layout file you create with the Label Designer.

Creating a class:You can create class libraries when you create classes using the Visual FoxPro IDE or empty class libraries programmatically. Visual FoxPro stores classes you create using the Class Designer in visual class library (.vcx) files. These classes include visual and non-visual classes. You can also choose to store class definitions in program (.prg) files when using the DEFINE CLASS command to create classes. Create a class using the Visual FoxPro IDE. In the Store In box of the New Class dialog box, type the name of the class library.

Use the CREATE CLASSLIB command to create an empty class library.

-ORInclude the OF clause in the CREATE CLASS command when you create a class.

For example, the following line of code uses the CREATE CLASSLIB command to create an empty class library named MyClassLibrary: CREATE CLASSLIB MyClassLibrary The following line of code includes the OF clause in the CREATE CLASS command to specify the name of the class library that will store the class MyClass, which is based on the Form class. CREATE CLASS MyClass OF MyClassLibrary AS Form

Advantage of visual basic foxpro:1. Programming tools:-With Visual FoxPro, procedural Xbase and object-oriented (OOP)
programming can be combined to create this planet's most powerful and sophisticated software applications. 2. Flexibility:-Visual FoxPro exposes an extremely large quantity of properties, events and methods (PEMs), which can be accessed and manipulated with VFP programming code. 3. Data driven applications:-Due to it's ability to concurrently open and manipulate an almost unlimited quantity of tables and cursors, Visual FoxPro has become an indispensable software development tool for creating data driven software applications.

4. Data processing and analysis:-Visual FoxPro is a highly efficient and flexible tool for
creating data processing routines and analyses for large and dispersed volumes of data records.

5. Supports high volumes of data:-Visual FoxPro is the perfect solution for organizations
with moderate to high levels of data transactions.

6. Web application development


Visual FoxPro is the ultimate software development tool for building Internet applications.

Disadvantage of visual basic foxpro:As with any software development product, there are environments where Visual FoxPro should not be used as a "complete" solution. However, Visual FoxPro is very often the best tool for creating and managing small databases, moderate size databases, large databases, and highly complex software applications for the desktop and Web.

1. Your organization processes "extremely" large quantities of records per hour. 2. Your application will require "extremely" high levels of concurrent usage.

3.

High levels of administrative security are required. We would recommend "SQL Server" in this instance. Although, Visual FoxPro could be used as it's Front-end.

4. Your organization requires a software development tool that can be easily used by non-programmers to make modifications. 5. The entire database application needs to be extremely portable. Depending on other circumstances, we may recommend Microsoft Access in this situation.

Applications of visual basic foxpro with object model:An application object is automatically created whenever Visual FoxPro is launched, either directly, through Automation or DDE. This application object provides access to all other objects created in a Visual FoxPro session through Collection properties.
Visual FoxPro application object model:-

Вам также может понравиться