Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB activex and visual fox pro 7.0

Status
Not open for further replies.

LindaRichard

Programmer
Feb 23, 2001
103
CA
I have a application in vfp 7.0 that includes an activex that I wrote in Visual Basic. This activex is a X-Y plot of a specialized diagram. I need to get my data from a view I built in vfp to my activex. Essentially I want to pass the data through a property or method array between vfp and Vb. This is what I would like to do:

In Visual Basic I wan't to define a property that is in fact an array that will contain the x,y coordinates.

In vfp I redimension the property to the data size and store the data

The activex gets the data from the property array and draws the diagram. (note the activex is included within the vfp project form) For example its easy to define a method or property in a visual basic activex and have it available for read/write in the host vfp. The problem that I am running into is defining an array in visual basic and being able to redimin vfp.

Thanks for your help.
Linda
 
Hi,

If you define your method in VB, something like ...

public sub mySub(byRef myArray() as integer)

... or whatever it should be, you can dimension your array in VFP and then pass the VFP array as an argument to the VB DLL, where you can manipulate it as usuall.

Hope this helps,

Dan.
 
Thanks for your response,

I tried to get it working with the following code without any success I keep getting an error message: type mismatch in visual fox pro.
Any suggestions? Thanks Linda

THIS IS THE CODE IN VISUAL BASIC

'---------------------------------------------------------------
'Declare the public data array
'---------------------------------------------------------------
Public myDataArray() As Integer

'---------------------------------------------------------------
'method
'---------------------------------------------------------------
Public Function myData(ByRef myDataArray() As Integer)

End Function


THIS IS VISUAL FOX PRO CODE

*----------------------------------------------------------------
*Declare the public data array
*----------------------------------------------------------------
PUBLIC ARRAY gnDataArray(1) as integer &&store actual data

*----------------------------------------------------------------
*pass the data to the activex
*----------------------------------------------------------------
DIMENSION gnDataArray(5)
gnDataArray(1)=25
gnDataArray(2)=26
gnDataArray(3)=27
gnDataArray(4)=28
gnDataArray(5)=29
ThisForm.oleWeiAve.myData(gnDataArray(1))

I also tried the line
ThisForm.oleWeiAve.myData(gnDataArray)
without success

Note: ThisForm.oleWeiAve is the activex in visual foxpro that includes the method mydata
 
Public myDataArray() As Integer
Public Function myData(ByRef myDataArray() As Integer)

*****************

That is your problem. You are declaring the name myDataArray twice. Choose a different name for the array in one of the locations. You should then be able to work with it just fine. The array myDataArray can then be worked with just like a normal array.

Hope that helps a bit.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top