Database development and training for Birmingham and the midlands
Specialists in Microsoft Access and Visual Foxpro database training and development
I am happy to hear from existing clients but I am taking no new calls.
Calling a VFP DLL from dotNet
The first step is to add the VFP DLL to the resources of the dotNet project. Right-click on the Solution Explorer and pickfrom the menu. Select the COM tab on the References dialog and scroll down to find . Click on the icon on the Solution Explorer toolbar to check that the reference has been added correctly.
Once you've added this reference to the project, VB's equivalent of Intellisense will recognise the new library and will suggest it as a type when you start writing the declarations in the program.
Write the program in VB.Net
This example uses a simple console application within Visual Basic. The program creates a customer object based on the VFP class, tells it to open a table then asks it to find the customer matching code "ANTON".
Dim intRecords As Integer
Dim objCust As vfpcustomer.Customer
'-- Create the customer and open the table.
objCust = New vfpcustomer.Customer
intRecords = objCust.OpenTable()
Console.WriteLine(CStr(intRecords) & " records.")
'-- Ask for the name of the custoemr coded as "Anton".
If objCust.Getname("ANTON") Then
The next steps
Doing this for a real project will be a much longer process but it might be easier than trying to convert FoxPro algorithms into a dotNet language. Many of our clients have been running Fox systems since the days of DOS. They are confident that the calculations embedded in these systems are correct. Using VFP DLLs as a halfway house on the way to developing a new dot Net system allows them time to make a gradual changeover to the new system.