After you design your form to be 100% self contained meaning it has to run correctly by it self in VFP as a stand alone form, modify your form and select Save As Class Save your form as a class under the name myForm for example in a visual class file ActiveXFormClass.vcx.
Modify the class and from Class menu select Class Info and check OLE Public and save.
Now, Start a new project ActiveXFormTest for example and add your class to it. Save the project and build as Exe COM Server (Not dll).
This will register your COM Server in your computer but donÆt forget to register it your self in any machine you will run your program on either manually Activexformtest.exe /regserver or through the Setup program.
Test your COM Server from VFP first
o=CREATEOBJECT("Activexformtest.myform") o.Visible=.T. o=Null RELEASE o
Start new EXE project from VB. From the Project menu select reference and check Activexformtest Type Library.
In the General declaration section (or wherever you see fit) add
Public loVFPForm As activexformtest.myform
It doesnÆt need to be public variable.
Now, add a command button and give it Caption Show VFP Form. In the click event add
Set loVFPForm = CreateObject("activexformtest.myform")
This is your VFP form as an ActiveX control or Out-of-Process COM Server or whatever name you like, it is just there.
Even though This will answer your question, I donÆt recommend this technique at all. From a design point of view, you suppose to separate your GUI from the Biz logic, what will happen if you want to run the same functionality your form offer over the Web?? So, instead of doing that try to design a Biz object provide you all the functionality you need in VFP and call it from VB native GUI,I believe this is a better design.