Type Declarations

Type Declarations

I define a user-defined type as follow..

Type Complex   Re As Double   Im As DoubleEnd Type
I created a function like this…
Function CompAdd( a As Complex, b As Complex ) As Complex   CompAdd.Re = a.Re + b.Re   CompAdd.Im = a.Im + b.ImEnd Function
I’m now using the Visual Basic 4.0. When I use this function by following by the following statement…
Dim c,d,e As Complexe = CompAdd( c, d )
the complier always say that variable ‘c’ is ‘ByRef argument type mismatch’.Do you have any suggestion to my problem? Thank you for your kind attention.

You’re probably getting the error because the Dim x, y, z as Complex probably isn’t working right. Try doing it as individual lines:

Dim c as ComplexDim d as ComplexDim e as Complex
That should take care of the problem. Basically, you are telling it to dim c and d as integers, and e as complex. It’s a little strange, but I’ve seen this problem too.


Share the Post: