Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

cwdsp1.fft vb.net type mismatch

 

 

Hello all,

 

I'm  trying to migrate the fft routine from VB6.0 to VB.net and having some issues.  The Routine calls for:

 

cwdsp1.fft(xr as object,xi as object,yr as object, yi as object)

 

So I say:

 

Dim r1() As Object

Dim i1() As Object

Dim r2() As Object

Dim i2() As Object

I fill up my arrays here then....

Myform.CWDSP1.FFT(r1, i1, r2, i2) ' FFT cw style

Here I get an error saying "type mismatch", even though it asks for objects and I'm giving it objects.

Any Ideas?  Thanx in advance,

B

0 Kudos
Message 1 of 5
(4,319 Views)
Hi,
 
Actually looking at your code, you have declared your variables as arrays of objects.  So in order to fix the type conflict, you need to give the function an indexed value of the arrays.  For example, Myform.CWDSP1.FFT(r1(1), i1(1), r2(1), i2(1)).
 
I hope this helps.
 
 
Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 2 of 5
(4,296 Views)
Thanx for the response, Caroline!
 
In VB 6.0, the fft routine calls for four parameters (fft(xr,xi,yr,yi)) with no typed parameters, but it needs arrays.  I have to pass it the entire array in order for it to do the fft, not just a point out of the array.  Are you saying if I pass
 
FFT(Xr(0), Xi(0),Yr(0), Yi(0))
 
That it would do an fft on the whole array?  That is how it works with some fortran dll's, pass the first point and it accepts the array.  I haven't tried that, but i'll give it a go.
 
I thought that since in VB.net the parameters were cast as Object it could accept any parameter...
 
Thanx again
0 Kudos
Message 3 of 5
(4,293 Views)
Ok, I tried the passing the first item in the array idea and it says the parameter is not an array.  However, in vb6.0 I passed an array...AAARRRRRGGHH!  🙂
0 Kudos
Message 4 of 5
(4,286 Views)
Hi,
 
After trying out the function I figured out what may be causing our problems.  First, you will want to define each of the arrays as such:
 
Dim r1 As Double()
 
This should work with the FFT function.  Also, I was wondering why you were not using the new Measurement Studio function for .NET (Transforms.FFT).  If you have MStudio 7.x then I would suggest using the new function for FFT.
 
Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 5 of 5
(4,269 Views)