DOCUMENT:Q255790 21-JUL-2000 [foxpro] TITLE :HOWTO: Use a DataCombo ActiveX Control in Visual FoxPro PRODUCT :Microsoft FoxPro PROD/VER:WINDOWS:6.0 OPER/SYS: KEYWORDS:kbActiveX kbADO kbContainer kbCtrl kbDatabase kbvfp600 kbVS600sp3 kbGrpDSFox kbGrpDSMDA ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual FoxPro for Windows, version 6.0 ------------------------------------------------------------------------------- SUMMARY ======= The Microsoft DataCombo control (Msdatlst.ocx) cannot directly use Microsoft Visual FoxPro tables as a data source. The DataCombo control can, however, be bound to an ActiveX Data Objects (ADO) recordset. This article illustrates how to bind a DataCombo ActiveX control to an ADO recordset from within a Visual FoxPro application. The code in this article requires installation of Microsoft Visual Studio Service Pack 3. MORE INFORMATION ================ NOTE: The Microsoft DataCombo control has not been tested with and is not supported by Microsoft Visual FoxPro. In order to bind a DataCombo ActiveX control to an ADO recordset, a recordset that can be bookmarked or a client-side ADO recordset must first be created. After this ADO recordset has been created, the DataCombo.BoundColumn, DataCombo.ListField, and DataCombo.RowSource properties are used to bind the control with the ADO recordset, as follows: WITH THISFORM.DataCombo1 .BOUNDCOLUMN = myrs.FIELDS(0).NAME && Source Field being bound to .ListField = myrs.FIELDS(0).NAME && Source Display Field .ROWSOURCE = myrs && Source Recordset ENDWITH 1. Create a program file named "DataCombo.prg" (without the quotation marks) using the following code: oX = CREATEOBJECT('MYFORM') oX.SHOW() READ EVENTS DEFINE CLASS myform AS FORM CAPTION = "DataCombo Control Form" HEIGHT = 250 LEFT = 0 TOP = 0 WIDTH = 375 NAME = "myform" ADD OBJECT DataCombo1 AS OLECONTROL WITH ; OLECLASS = "MSDataListLib.DataCombo.1",; TOP = 25, ; LEFT = 25, ; HEIGHT = 22, ; WIDTH = 175, ; NAME = "DataCombo1" ADD OBJECT textBox1 AS TEXTBOX WITH ; TOP = 65, ; LEFT = 25, ; HEIGHT = 25, ; WIDTH = 150, ; NAME = "textBox1", ; CONTROLSOURCE = "demo.cCustName" ADD OBJECT commandButton2 AS COMMANDBUTTON WITH ; TOP = 225, ; LEFT = 275, ; HEIGHT = 25, ; CAPTION = "\