VFP FAQ
We've added a lot of FoxPro advice to this site over the years but some questions are
too short to need a page of their own. Here are some answers to the shorter questions.
How can I run my FoxPro legacy system under Windows 7
Visual FoxPro will still run under Windows 7 but earlier DOS and Window versions will
not. The long term solution is a rewrite but it might be possible to recompile a Fox2.6
system into VFP 9 or to run the original executable in a Windows 2000 virtual machine.
Are there any keyboard shortcuts in FoxPro?
Too many to list here. Type help keyboard shortcuts into the
Command Window. Press if the Command Window is
not visible.
Can I export my data to Excel
Use COPY TO myFile.xls TYPE XL5 to copy all records
from the current table to an Excel spreadsheet. Remember that VFP 9 was written when the
Excel file format was limited to 65,535 rows. You might have to export to a csv file
instead
COPY TO myFile.xls TYPE CSV
and then open that text file in Excel 2007 or 2010.
Can I pass a parameter to a form?
Use the syntax
Do <formName> With <parameterList>
to call the form and accept the parameter in the form's Init event. This page
has an
example.
Can I replace the textbox in a grid with another control?
A grid column is a container which can hold any other type of control - even another
container control such as a pageframe or grid. Replace the textbox with this
technique.
FoxPro does not recognise 1 as being a true value
Fox has always had a separate boolean data type so there has never been a need to use
integers to represent logical values. Booleans are delimited by a period in Fox, true,
false and null are represented by .T., .F. and .NULL. respectively.
How do I generate multiple controls from the Data Environment
If you select multiple fields from the Data Environment and drag them onto the form
then you will get a grid control. Use the right mouse button to drag them if you
want a separate control for each field.
I keep getting an "Ambiguous date/datetime constant" error.
At the time of the millenium bug Fox gained a STRICTDATE
setting. This prevents you using anything which might possibly be construed as being
ambiguous and insists that you specify dates as {^2008-12-24}. Get back to normal
by using SET STRICTDATE TO 0 or by selecting
and turning Year 2000 compliance
off.
I need to index a cursor
A FoxPro dbf file includes a flag to indicate whether or not the table has an index file
associated with it and you can't set this flag in a read-only cursor. Use the
READWRITE option to create a read/write cursor. More
tips on
cursors
on this page.
I need to return more than one value from a function
A FoxPro function can only return a single value but this can be an
object
with any number of properties.
Is FoxPro dead?
Microsoft have promised support until
2015.
We have some thoughts on how to
Replace FoxPro.
Is Visual FoxPro compatible with FoxPro 2.6?
All versions of FoxPro can read data and run programs from earlier releases. These
pages descibe the
conversion
process.
My combo box is throwing an error instead of displaying choices
This is probably because it can't find its RowSource. Remember that the form's Init
event runs after the Init events of all the controls on the form. If you are preparing
the RowSource in Form.Init then you're too late. Use the Load event of the form instead
because this runs before the controls initialise themselves and you can make sure that
the data needed by the controls is available before they start to appear.
The pages in a pageframe won't accept any controls.
You need to select the page before adding a control. Right-click on the pageframe and
select from the menu. A turquoise frame will
surround the pageframe and you will be able to click on the tabs to select the page
that you want.
What does an 'm.' prefix mean in a FoxPro program?
A name such as 'company' may refer to a variable or to a field of the current table.
If there is such a conflict then FoxPro will use the value in the field. Use the m.
prefix if you need to refer to the
variable.
This technique was very common in earlier versions of FoxPro where the
Scatter and Gather
commands would copy data between variables and fields of the same name.
What is a tbk file?
This is the backup of a FoxPro memo file. If a FoxPro table has any Memo or General
fields then these will be stored in an fpt file with the same name as the dbf. If you
change the structure of the table then the original dbf will be stored as a bak file
and the original fpt will be stored as a tbk.
What does STORE mean?
This is an old way of assigning a value to a variable. The command
STORE 3 TO fred is exactly the same as
fred = 3 but takes longer to type.
Why do I get the 'Cannot Quit Visual FoxPro' message?
This message appears because the event-handling loop is still running. Add a
Clear Events
command to resolve the problem.
Why does my application vanish from the screen?
Visual FoxPro is event-driven. The event-processing loop runs automatically in the
development environment. Use the
Read Events
command to start the loop at runtime.
|