Frequently Asked Questions for
Microsoft Visual FoxPro 6.0 for Windows

These are some of the most frequently asked questions about Visual FoxPro. Please scan this list before you call Microsoft Technical Support.

To print these notes, choose Print from the File menu. This document is divided into the following four parts:
---------------------------------------------------------------------
Part 1. Support and Marketing
Part 2. Visual FoxPro 6.0 New Features
Part 3. Migration from other version of FoxPro
Part 4. Common Visual FoxPro questions
---------------------------------------------------------------------

Part 1. Support and Marketing

Question 1-1:  Where can I find product updates?

Answer:  The best place to get information on product updates, including Service Packs and updated samples, wizards, and other code, is on the Visual FoxPro Web site at the following URL location:

www.microsoft.com/vfoxpro

Please check the Web site on a regular basis to download the latest updates.

Question 1-2:  Where can I go for more information about Visual FoxPro?

Answer:  The best way to keep abreast of all new product announcements is through the Microsoft Visual FoxPro Web site. In addition to new product announcements, this site also features product updates, technical articles, white papers, cool samples from expert developers, conference announcements, and links to many other FoxPro web sites.

Question 1-3:  How do I obtain product support and report bugs?

Answer:  The Microsoft Visual FoxPro Web site has links to a variety of online support options including the extensive Microsoft Knowledge Base of all products. You can also access a list of Frequently Asked Questions. In addition to online support, you can also call for direct product support. The Help menu has an option listing technical support phone numbers. These numbers can also be used to report issues that you think may be product bugs.

Question 1-4.  What is the Knowledge Base and how do I use it?

Answer: The Knowledge Base is an extensive list of articles covering how to use product features, known bugs and their resolution or workarounds, and other useful information to help you use various Microsoft products. The entire Knowledge Base is available online at the following URL location:

	support.microsoft.com

Question 1-5: Will there be a Visual FoxPro 6.0a?

Answer:  Microsoft is committed to producing high quality products. If the need arises we may provide bug-fixes for Visual FoxPro 6.0. However, these would not be in a 6.0a release. Any bug fixes to Visual FoxPro 6.0 would be included in Visual Studio Service Packs. These would be announced on either the Visual FoxPro www.microsoft.com/vfoxpro or the Visual Studio www.microsoft.com/vstudio Web sites. 

Question 1-6:  Microsoft offers a number of great solutions for developing applications. How do I know which product to use and recommend to my clients?

Answer:  There are a number of factors that go into choosing the right product for a job. The Microsoft Visual FoxPro web site contains an excellent strategy backgrounder paper describing the differences between Microsoft products like Visual FoxPro, Visual Basic, SQL Server, and Access.

Question 1-7:  Where do I find samples using Visual FoxPro?

Answer:  Visual FoxPro 6.0 ships with an extensive collection of samples including a number of new ones for 6.0 specific features. Unlike prior versions of Visual FoxPro, the samples are now installed in a location for all Visual Studio samples. You must choose to install the samples by running a Custom setup. In Visual FoxPro, use the new HOME(2) function to easily find the location of the samples you chose to install.

In addition to shipping samples, the Microsoft Visual FoxPro web is frequently updated with new samples.

Question 1-8:  Many times I will read an article on the Microsoft web site and see sample code for Visual Basic and Visual C++. Does this mean I can not use Visual FoxPro?

Answer:  No. Particularly when it comes to calling and using objects, the syntax in Visual Basic and Visual FoxPro is almost identical. You can usually take Visual Basic code and quickly change it into the correct syntax for Visual FoxPro. The similarity in syntax also means that, often, the code in a Visual Basic book or magazine is highly useful to Visual FoxPro developers. 

Question 1-9:  I've been using Visual FoxPro for years? Why should I upgrade to Visual Studio?

Answer:  Microsoft Visual Studio is the ultimate application development solution for professional developers. As application development becomes more focused on component-based systems that integrate client/server and the Internet, it is necessary to have a wealth of tools that meet the demands of today's developer and the changing needs of businesses. Microsoft Visual Studio offers a complete set of tools for the professional developer. Visual Studio Professional Edition includes Visual FoxPro, Visual Basic, Visual C++, Visual J++, and Visual InterDev. Visual Studio Enterprise Edition includes those five tools plus Visual SourceSafe and SQL Server.

Question 1-10:  How can I obtain additional marketing related information as well as requesting participation in future betas of Visual FoxPro?

Answer:  Send mail to the following email address:

	foxmktg@microsoft.com

There is no guarantee that you will be selected as a beta participant since the number of people requesting to be on the beta often exceeds the number of available slots. 
---------------------------------------------------------------------
Part 2. Visual FoxPro 6.0 New Features

Question 2-1:  What's new in Visual FoxPro 6.0?

Answer: There are many exciting new features in version 6.0. These include custom Automation server improvements, Active Documents, OLE Drag and Drop support, Access and Assign methods, and the Component Gallery to name just a few. For more information on new features and new language, click "What's New" on the Visual FoxPro Start Page in the MSDN Library browser.

Question 2-2:  What is an Active Document and when should I use it? How does it differ from Active Documents in Visual Basic?

Answer: Active Documents are a way of deploying your Visual FoxPro applications on the intranet. You can use Active Documents to run forms created with Visual FoxPro, containing Visual FoxPro code, directly in the Microsoft Internet Explorer web browser.

In Visual Basic, Active Documents are merely forms that have been modified slightly to support features specific to Internet Explorer. Active Documents in Visual FoxPro are slightly different. The ActiveDoc class is a non-visual class that acts more like an application object handling events necessary to run existing Visual FoxPro forms in the browser. Therefore, the conversion of forms is not necessary. Several new properties including form ScrollBars and TitleBar properties were added to conform to user interface standards when hosted in Internet Explorer.

It is important to understand that the Visual FoxPro ActiveDoc you run in Internet Explorer is merely an application (.app) file that could be run directly within Visual FoxPro. Because of this, the run-time version of Visual FoxPro is required. Therefore, Active Documents are more suitable for intranet environments where constraints of downloading the large Visual FoxPro run-time files are not as severe as over the Internet where most users use modems to gain access. The good news is that the run-time files need to be downloaded only once.

Question 2-3:  What is the difference between OLE Drag and Drop, and the Drag and Drop that existed in Visual FoxPro 5.0?

Answer: Prior to this version, Visual FoxPro supported Drag and Drop between forms and controls on these forms. This type of Drag and Drop was proprietary to Visual FoxPro, which meant that you could not drag to and from other non Visual FoxPro applications.

With this version, Visual FoxPro now supports true OLE Drag and Drop, which is the same type of Drag and Drop used by other Windows-based applications. Your applications can now use this standard to support drag and drop of data between other applications such as Microsoft Excel and Word.

Question 2-4:  Why are there two application wizards?

Answer: In an effort to simplify application development for Visual FoxPro developers, many new features were added to version 6.0 including a new Application Framework, Application Builder, and Component Gallery. The older Application Wizard that shipped with version 5.0 is included for backward compatibility. The newer wizard, which simply asks for a project name and location, simplifies the entire application creation process.

Question 2-5:  What is the difference between a Project object and a ProjectHook object?

Answer: Whenever a project (.pjx) file is opened, a Project object is created. This project can be referenced with the following code:

	_VFP.ActiveProject

The Project object has properties for all the information available in the Project Information dialog box, including Collections for files and servers.

Because developers want to interact with various events associated with a project, such as adding files or doing builds, it was necessary to create a new class (ProjectHook) to support code for these events.

ProjectHook classes are optional for a project. If a ProjectHook class is specified for a project (as specified in the Project Information dialog box), it is instantiated when the project is opened (this includes commands such as BUILD APP), and destroyed when the project is closed.

Question 2-6:  How can I add check boxes in my ListBox control?

Answer: A commonly requested enhancement has been to add check box support to the Visual FoxPro native ListBox control. The new version of the Microsoft ActiveX ListView control as well as the Treeview control now support check boxes. These controls ship with Visual FoxPro 6.0 (see Question 2-7).

Question 2-7:  My Visual FoxPro 5.0 forms containing certain controls such as ListView or TreeView do not inherit the latest features of these controls (such as check box support). Distributed applications with these forms do not function correctly on end-user machines because of an OLE error with the form.

Answer:  In version 6.0, the file containing the following ActiveX controls was renamed from Comctl32.ocx to Mscomctl.ocx:

	Microsoft ListView Control
	Microsoft TreeView Control
	Microsoft ImageList Control
	Microsoft ProgressBar Control
	Microsoft StatusBar Control
	Microsoft Slider Control
	Microsoft Tabstrip Control
	Microsoft Toolbar Control

Even though Visual FoxPro 6.0 upgrades to the new Mscomctl.ocx file, older version 5.0 forms with these controls will still reference the older file since the ActiveX control is bound by its OleClass property. ActiveX controls from the older Comctl32.ocx file have a version of 1. For example, the OleClass property for a ListView control on a 5.0 form would say:

	COMCTL.ListViewCtrl.1

Newer ActiveX controls in the Mscomctl.ocx file have a version 2 (or higher). For example:

	COMCTL.TreeViewCtrl.2

Visual FoxPro will not automatically upgrade your control, so it is important to know which version of an ActiveX control a form uses when distributing your applications.

Question 2-8:  Can I create my own user-defined Collections in Visual FoxPro 6.0?

Answer: Visual FoxPro 5.0 did not directly support the creation of Collections, which are similar to arrays of objects. The Form object's Controls property is an example of a collection. Visual FoxPro 6.0 supports Access/Assign methods that can be used to create real user-defined Collections. There is an excellent example of this in the Solutions sample application.

Question 2-9:  Why don't my Visual FoxPro 5.0 Automation servers work with Microsoft Transaction Server or Active Server Pages?

Answer: A number of server improvements were made in version 6.0, including support for apartment-model threading to make servers scale better and run smoother in Active Server Pages and Transaction Server. Type library improvements now allow applications such as Visual Basic to see properties and methods in command completion dropdowns.

You may also experience a Remote Procedure Call error using the Visual FoxPro 6.0 or 5.0 Automation servers with Microsoft Transaction Server 2.0. If this happens, make sure you have at least Service Pack 1 or higher of Transaction Server 2.0.

Question 2-10:  I want to write an Internet application using Visual FoxPro 6.0. There are a lot of new features for doing this. Where do I start?

Answer: Visual FoxPro provides a variety of tools that you can use for creating applications to deploy over the Web. 

The new Web Publishing Wizard and GENHTML features are excellent tools for generating a variety of HTML output to publish your Visual FoxPro data. Depending on your needs, there are options for generating both static and dynamic HTML. You can even use the Web Publishing Wizard to generate a script that can be executed at runtime to regenerate your HTML.

Visual FoxPro also supports the creation of COM components (formerly known as Automation servers) that can be used as middle-tier objects in a web application. These objects can be deployed to access and process Visual FoxPro data natively, through ODBC or ADO as well as handling business rules. Visual FoxPro COM components can be accessed directly within Active Server Pages and Microsoft Transaction Server. You can also use the FOXISAPI extension that ships with Visual FoxPro. This extension can be called by Microsoft Internet Information Server to request HTML from a Visual FoxPro COM component by invoking a method that returns the HTML directly.

The new Active Document technology is another option that allows you to take existing Visual FoxPro forms and run them over an Intranet setting. Because the Visual FoxPro runtime is required, it is not always ideal to deploy over the Internet.

Question 2-11:  Why does the new Scrollbars property for forms not display scroll bars on my form when I change this property at runtime?

Answer: Before a form is created, Visual FoxPro reads the form's Scrollbars property setting because the value of this property determines how a form is created. If the value of the Scrollbars property is 0 (no scroll bars), Visual FoxPro creates a Visual FoxPro 5.0 style light-weight form. If the value of the Scrollbars property is a value other than 0, Visual FoxPro creates a form that consumes more memory. When designing your applications, keep in mind that forms with scroll bars require more memory.

If the Scrollbars property is set to 0 at design time, the Scrollbars property at runtime is read-only because Visual FoxPro initially creates a light-weight form. However, if the Scrollbars property is set to a value other that 0 at design time, Visual FoxPro allows the Scrollbars property to be read-write at runtime because there may be code that calls the SAVEAS() function to create a new form with scroll bars. If you have no need for scroll bars on a form (for example, the form uses page frames), then set the Scrollbars property to 0 at runtime to save memory.

If the Scrollbars property is set to a value other than 0 at design-time, you can change the value of the Scrollbars property at runtime. However, if you change the value of the Scrollbars property to 0, Visual FoxPro hides the scroll bars on the form; a new light-weight form isn't created.
---------------------------------------------------------------------
Part 3. Migration from other versions of FoxPro and Visual FoxPro

Question 3-1:  What should I be concerned about when moving my Visual FoxPro 5.0 applications to Visual FoxPro 6.0?

Answer: Visual FoxPro 5.0 applications will run as is directly in Visual FoxPro 6.0. If the code in your 5.0 application contains any references to system menu pads and bars (like _msystem), you must recompile the code. You can also create applications in 6.0 and run them in 5.0, however, if you do this, your code must not contain any new 6.0 language. Databases can be shared between the two versions.

The file format for menu (.mnx) files has been slightly changed to accommodate new ActiveDoc support. If you try to open a 5.0 menu in 6.0, you will be prompted to convert to the new format.

The new menu format will be compatible with 5.0 versions of GENMENU and other XBase utilities that read the .mnx file. However, the Visual FoxPro 5.0 menu designer will not be able to open the 6.0 format. To convert a 6.0 .mnx file back to the 5.0 format, you can use the following command:

	ALTER TABLE mymenu.mnx ALTER COLUMN location N(1)

However, the NEGOTIATE information for menu pads may be lost or corrupted in doing so.

Project (.pjx) files are still the same; however, new ProjectHook information is stored in these files. Therefore, if you are using 6.0 projects with ProjectHooks (which are optional), you should avoid opening them in 5.0.

Please read the "Upgrading" section in Help.

Question 3-2: Why do I have to execute SYS(2333,0) to allow various ActiveX controls to work properly in Visual FoxPro 5.0?

Answer: In Visual FoxPro 6.0, the default is now SYS(2333,0) so this is no longer required.  It is recommended that _vfp.AutoYield is set to .F. also.

Question 3-3:  What should I be concerned about when moving my Visual FoxPro 3.0 applications to Visual FoxPro 6.0?

Answer: Applications written in Visual FoxPro 3.0 will need to be recompiled to run in Visual FoxPro 6.0 since the object code is not binary compatible between versions.

The database (.dbc) file format between 3.0 and 5.0 was changed, so it is not practical to share databases between applications written in 3.0 and 6.0 unless 3.0 users access the data through the Visual FoxPro ODBC driver (using Remote Views).

The format for form (.scx) files and class (.vcx) files was modified slightly between 3.0 and 5.0 (see Question 3-5). As in version 5.0, when opening a 3.0 form or class in version 6.0, the Converter is invoked.

Project files were updated in version 5.0 to support source control integration. Therefore, 3.0 projects are automatically converted to support source control when opened in version 6.0.

See Question 3-1 for more details on changes between menu and project files made between 5.0 and 6.0. Also, please read the "Upgrading" section in Help.

Question 3-4:  What is the cross-platform strategy for Visual FoxPro?

Answer: Please read Question 3-3 above because the current version of Visual FoxPro for Macintosh is 3.0. There are a number of alternative cross-platform solutions for Visual FoxPro for Windows developers that should be seriously evaluated. Consider using Microsoft Internet Explorer for Macintosh as a front-end to your Mac users. Visual FoxPro 6.0 Automation servers can be used to access Fox data and output it as HTML. The FoxISAPI utility (with new pool manager support included with 6.0) is one such solution.

Question 3-5:  If I edit or run my Visual FoxPro 3.0 forms in Visual FoxPro 6.0, the fonts are smaller and no longer appear bold. Why does this happen and how can I avoid this?

Answer:  To enable you to more easily make forms that comply with the Windows 95 standard, several default property settings for controls were changed, including FontSize, FontBold, and ColorSource. If these were set to default values under Visual FoxPro 3.0, they will remain defaults under Visual FoxPro 6.0. However, because the defaults are different, text will be displayed differently.

If you want to have your forms appear as they did in Visual FoxPro 3.0, convert them as part of a project. Then when you open the Visual FoxPro 3.0 project in Visual FoxPro 6.0, check the Retain Visual FoxPro 3.0 Default Property Values check box in the Converter.

Question 3-6:  What should I be concerned about when moving my FoxPro 2.x applications to Visual FoxPro 6.0?

Answer: Visual FoxPro 3.0 was a major upgrade for FoxPro developers. In fact, because of the paradigm shift (see Question 3-7), some people consider Visual FoxPro an entirely new product. Because of the new object-oriented shift, most of the file formats were changed.

Visual FoxPro ships with a Converter utility that handles all file format changes. However, it does not convert your procedural code to object-oriented code except for visual user interface items. It is important to know that your existing FoxPro 2.x code will still run as is. We do recommend that you migrate your source to object-oriented code where possible to take advantage of many new features as well as more efficient development practices.

One of the popular new features of Visual FoxPro is support for real databases (as a collection of tables). The term "database" was often used interchangeably with "table" in FoxPro 2.x and prior versions.

Please read the "Upgrading" section in Help.

Question 3-7: When should I use object-oriented programming (OOP) instead of procedural programming? Is it better to create classes visually or through program code?

Answer:  You can continue to use a traditional procedural programming style in Visual FoxPro if you prefer it. Most FoxPro version 2.x programs coded in procedural style will run with only minor modifications in Visual FoxPro. 

However, consider making the transition to an OOP programming style if the following conditions are true:

	1.  Your organization currently participates in a 
	    structured, analytical process for new programming projects.

	2.  You are willing to invest the resources necessary to develop 
	    a library of reusable code, without realizing full payback 
	    on this investment until after the current project.

	3.  You want to tap the power of Visual FoxPro event handling, 
	    common code syntax, and other benefits associated with OOP.

When you create a class programmatically, you must know all of the commands necessary to complete a task, but you can also inspect any portion of code at any time. If you create a class visually, you do not need to know all of the commands to complete a task, but you must look at each method individually. One of the benefits of Visual FoxPro is the ability to add a class defined through code to a form, save the instantiated objects as a class, and then edit those classes visually. This functionality, combined with the ability to export code through the Class Browser, provides the best of both types of class design tools.

Question 3-8: My client's data needs have expanded. How can I move my Visual FoxPro data to Microsoft SQL Server?

Answer: Visual FoxPro ships with an Upsizing Wizard that moves FoxPro databases to SQL Server or Oracle. The Wizard has options to automatically create remote views in your database that access the new SQL Server data. This strategy allows you to retain existing forms and reports that access data sources with little or no modification.

Question 3-9: Why is there a new Mscomctl.ocx file? Do I still need a new Comctl32.ocx file? What are some potential issues?

Answer: The Visual FoxPro 5.0 Comctl32.ocx file contains the following ActiveX controls:

	Treeview
	Listview
	Slider
	Imagelist
	Status Bar
	Tabstrip
	Progress Bar
	Toolbar

With Visual FoxPro 6.0, updated versions of these controls are being released in the new Mscomctl.ocx file. This was done primarily because a number of new features were added to these controls such as checkbox and hover support.

The following issues are important to Visual FoxPro developers:

- Visual FoxPro does not automatically update ActiveX controls on forms to use the newer version. So, existing forms that use controls such as the Treeview control will still reference the old Comctl32.ocx file.

- Once a control is added to a form, you cannot update or change the version. This is done intentionally so that newer ActiveX control versions do not break code if for some reason the newer version was not backward compatible. 

- You can determine which version of a control you have by viewing the OleClass property of that control in the Properties window.

	For example:
	COMCTL.ListViewCtl.1		(newer Comctl32.ocx version)
	COMCTL.ListViewCtl.2		(newer Mscomctl.ocx version)

- It is critical that you know which version of a control your forms use for distribution purposes. If all your forms use the older Listview control, you wouldn't want to ship the new Mscomctl.ocx file. The Setup Wizard lets you select the particular file to include with your distributed applications.

- Another important issue for developers who have both Comctl32.ocx and Mscomctl.ocx controls installed and registered on a single machine, is to ensure that the Mscomctl.ocx is always registered last. When you add an ActiveX control to a form, the Insert Object dialog box displays a list of controls. It is possible that the dialog box does not display the latest versions of these controls.

The current version is not always the latest version, but rather the last one registered. So, if by chance you register Comctl32.ocx after installing Visual FoxPro, you can easily reset the Mscomctl.ocx file as the current one by running Regsvr32.exe from the Windows Start menu -> Run dialog box. For example, run:

	REGSVR32 c:\Windows\System\Mscomctl.ocx

This ensures that you are always installing the latest version of these ActiveX controls.
---------------------------------------------------------------------
Part 4. Common Visual FoxPro questions

Question 4-1:  How do I hide the Visual FoxPro desktop when my application's .exe file starts?

Answer:  Put the following line in the Config.fpw configuration file:

	SCREEN=OFF

Note: If you do not need to provide the Config.fpw as a separate file-- that is, you will not need to be making any changes to it after building the .exe--you can add the Config.fpw file to the project, making sure it is marked as included, and it will be built as part of the .exe. Visual FoxPro will not hide the desktop unless there is a top-level form active. You can also programmatically hide the desktop with the following command (assuming that a top-level form is already active):

	_VFP.Visible = .F.

Question 4-2:  How do I create a top-level form with a top-level menu?

Answer:  To create a top-level form, set the form's ShowWindow property to 2-As Top Level Form. To create a top-level menu, open the Menu Designer. From the View menu, choose General Options, then select the Top-Level Form check box. To place the top-level menu in the top-level form, you must place code in the Init (or other) event of the form. For example:

	DO <menu name.mpr> with THIS,.T.

To see various options for calling the top-level menu, read the header in the generated .mpr file.

Question 4-3:  Some of the forms in the Solutions sample files do not display label or control captions correctly. Why not?

Answer:  The forms in the Solutions sample are designed to display correctly with the Windows default font setting (small fonts). If you use large fonts, some of the forms will not be displayed correctly. To use small fonts, in the Control Panel double-click the Display icon; then in the Display dialog box, choose the Settings tab. In the Font Size drop-down list, choose Small Fonts.

Question 4-4:  Do I need to use the Join Source Control Project option on the Project menu every time I open a Visual FoxPro project that is under source control?

Answer:  No, you do this only once. When you select Join Source Control Project, Visual FoxPro creates a copy of the existing project (.pjx) file on your local disk in the project's working directory. Visual FoxPro also creates a project (.pjm "project metafile")file list that it uses to manage the changes made by different developers to the list of files in the project.) After you have joined a project, you can open the project as usual and Visual FoxPro will recognize that it is under source control.

Question 4-5:  When I add a file to a Visual FoxPro project under source control I get the following error message:

     "File <file name> could not be mapped to the SourceSafe project $/<project name>"

The message is then followed by this message in the Source Control Results window:

     "SCC API error 'Operation not performed' occurred on file <file name>."

The added file is not visible to other users sharing the project, even after I choose Update Project List.  What am I doing wrong?

Answer:  When adding files to a Visual FoxPro project under source control, save them to the working directory in which the copy of the current project was created.

Question 4-6:  I just added a file to a Visual FoxPro project under source control and have added the file to source control as well, but it is not visible to other users sharing the project. What's wrong?

Answer:  After creating a new file or adding a file to a project, you must update the project list (.pjm) file so that the new or added file becomes visible to other users. From the Source Control submenu on the Project menu, choose Update Project List. Visual FoxPro then merges your local project file list with the one stored centrally. Other users must then also do the same. When they do, Visual FoxPro merges the changes with their local project list (.pjm) file and rebuilds their local project (.pjx) file.

Question 4-7:  What is an offline view and what can I use it for?

Answer:  An offline view allows you to get a snapshot of a table and manipulate it without having to be connected to the host table. When you are finished with the table, you can connect to the host again and synchronize the view with the host table. Using offline views, you can:

         * Replicate a subset of data from Visual FoxPro table or a remote data 
           source.
         * Manipulate the replicated subset either interactively or through an 
           application.
         * Share a change buffer table while off line.
         * Reconnect to the proper data source.
         * Batch update the local or remote table(s).

These features can be very useful if you need to work with a small portion of data without being physically connected to its source -- for instance, when you are travelling or working offsite and you need to work with the most current data in a table.

Question 4-8:  What is the difference between the DataSource property and the ControlSource property? RowSource property vs. RecordSource property?

Answer:  The DataSource property affects ODBC views stored in a database (.dbc). It contains a reference to the name of the data file to which ODBC is connecting, and must point to a valid data source defined through the ODBC administrator. You can manipulate the DataSource property with the SQLSETPROP() function and view its settings with the SQLGETPROP() function.

The ControlSource property is used to determine the source of data to which an object is bound; the table or view to which the object is bound can be of any type, including local Visual FoxPro tables. Objects that have a ControlSource property include the CheckBox, Column, ComboBox, CommandGroup, EditBox, ListBox, OLE Bound Control, OptionButton, OptionGroup, Spinner, and TextBox controls.

Several controls (ListBox and ComboBox) allow you to display more than one field and row at a time. In addition to the ControlSource property, these controls also have a RowSource property for this. Data is still bound to a single field which is why these controls have a ControlSource property. The Grid control is unique in that it has a RecordSource property, but not a ControlSource property. With Grids, data is bound to an entire set of records.

Question 4-9:  Why is my combo box displaying only one row of data?  I dimensioned an array for the combo box and issued a SELECT - SQL command in the Init event of my form to populate the array.

Answer:  You created an array in the form's Init event with no rows or with only one row. When the form is created, the Init event of the combo box occurs before the Init event of the form, and the combo box therefore contains only one row of information. To fix this, add the following line of code immediately after the SELECT - SQL statement that creates the array in the form's Init event:

	THISFORM.ComboBox1.RowSource = THISFORM.ComboBox1.RowSource

Question 4-10:   How do I hide specific columns in a combo box and display others?

Answer:  The easiest way to hide specific columns in a combo box is with the Combo Box Builder. Drag the columns to the desired width in the Layout tab of the Combo Box Builder.
To hide specific columns in a combo box programatically, set the ColumnWidth property to 0 for the columns. In the following program code, Columns 1 and 2 are hidden, and Column 3 has a width of 100 pixels:

	THISFORM.ComboBox1.ColumnWidths = 0,0,100

Question 4-11:  Using Visual FoxPro 6.0 running on Windows 95, I created an .exe file and used the Setup Wizard to make distribution disks. Now the application will not run on any Windows for Workgroups machines.  Why is this?

Answer:  Visual FoxPro 6.0 is a 32-bit application and will create only 32-bit .exe files.  Windows for Workgroups is a 16-bit operating system and can run only 16-bit applications.  You need to have Windows 95 or Windows NT 4.0 or later to run your Visual FoxPro applications.

Question 4-12:  Can I customize the colors used to mark syntax in an edit window?

Answer:  You can easily customize how your code looks by choosing Options from the Tools menu and selecting the Syntax Coloring tab in the Option dialog box.  There you will find a variety of ways to customize the coloring of your code.

If you would like to turn syntax coloring off completely, from the Edit menu choose Properties to display the Edit Properties dialog box. Then clear the Syntax Coloring check box.

Question 4-13:  Can I customize the comment marks used to comment out syntax in an edit window?

Answer: Visual FoxPro does not directly support changing this option through the user interface, however, you can manually change this setting by adding a new setting to the Windows Registry. First, open the Registry using RegEdit (type RegEdit in the dialog prompted from Windows Start -> Run... menu). Next, locate the following Registry key.

	HKEY_CURRENT_USER\Software\Microsoft\VisualFoxPro\6.0\Options

You should see a number of familiar settings in the viewing pane on right-side. These are the settings saved from the Visual FoxPro Options dialog. To add the new comment mark, select New -> String Value from the Edit menu and type in the following value:

	EditorCommentString

Finally, double-click on this new Registry entry and add the new comment mark that you want to use (by default, Visual FoxPro uses *!*). Make sure your entry starts with an * since this denotes a comment in FoxPro code when compiled.

Question 4-14:  Can I customize the default number of items in a combo box's drop-down list like the one used in the Code window or Property window?

Answer: Visual FoxPro does not directly support changing this option through the user interface, however, you can manually change this setting by adding a new setting to the Windows Registry. First, open the Registry using RegEdit (type RegEdit in the dialog prompted from Windows Start -> Run... menu). Next, locate the following Registry key.

	HKEY_CURRENT_USER\Software\Microsoft\VisualFoxPro\6.0\Options

You should see a number of familiar settings in the viewing pane on right-side. These are the settings saved from the Visual FoxPro Options dialog. To add the new DisplayCount, select New -> String Value from the Edit menu and type in the following value:

	DisplayCount

Finally, double-click on this new Registry entry and add the new number of lines to display (by default, Visual FoxPro 5.0 uses 7, and Visual FoxPro 6.0 uses 15 ).

The DisplayCount property of user combo boxes still defaults to 7, to be backward compatible.

Question 4-15: I am having problems using the Treeview and Listview ActiveX controls. For example, the images in the associated ImageList control are not being found. Why is this happening?

Answer: The problem may be due to the version of Comctl32.ocx that you have installed. If you have a registered version of Comctl32.ocx or Mscomctl.ocx (new for Visual FoxPro 6.0) in your Windows\System directory that is dated after 8-21-96, you cannot associate an ImageList control with the Treeview or Listview control via the Property Page. The solution is to manually place code such as the following in the Init event of the control:

	ex. Treeview Init
	this.object.ImageList=thisform.imagelist1.object 	&& imagelist1=imagelist object

	ex. Listview Init
	this.object.Icons=thisform.imagelist2.object 		&& imagelist2=imagelist object
	this.object.SmallIcons=thisform.imagelist3.object	&& imagelist3=imagelist object

The following also applies to using a registered Comctl32.ocx file dated after 8-21-96:

If you have a form (.scx) or class (.vcx) container that has a TreeView or ListView control using an ImageList control, and the form or class was saved using a Comctl32.ocx dated 8-21-96 (the version that ships with Visual FoxPro 5.0), then that form or class will run under any older or the newest version of Comctl32.ocx, so forward compatibility is fully retained.

If you create and/or save a form or class that uses a control within Comctl32.ocx, and your Comctl32.ocx is dated after 8-21-96, then the same version of Comctl32.ocx or later will be required to modify and/or run that form or class. New versions of Comctl32.ocx are forward compatible only, not backward compatible.

Question 4-16: I have a Treeview or Listview ActiveX control that is slow in loading items. Is there a way to improve performance?

Answer: When populating a TreeView or ListView control, add the following logic:

	treeview.Visible=.F.
	treeview.Top=treeview.Top+9999
	<add your code here to populate treeview here>
	treeview.Top=treeview.Top-9999
	treeview.Visible=.T.

Usually this doubles the load performance, mainly because the control doesn't try to refresh its own user interface for every addition of a node.

Question 4-17: I am having problems running the second FoxISAPI sample (FOXIS.EMPLOYEE) from my web browser even though I can instantiate the server from within Visual FoxPro. Why?

Answer: Often when there are issues such as this where the server runs fine in Visual FoxPro but not in the browser, you have a configuration problem. It's likely that you have not provided proper access rights for your web server which can be resolved by running the Dcomcnfg.exe file and changing these settings. For more information, search for "FoxISAPI: An OLE Server Sample" in Help.


