ByRef argument type mismatch error in VB6. - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


ByRef argument type mismatch error in VB6.

joed222joed222 Posts: 1Member
I'm experiencing a ByRef argument type mismatch error in VB6.

I have a UDT called "am_towers" defined in a public class module.

In a second class module called "DA" (in a separate active-x dll called "Field") I have a property let & get that uses the UDT am_towers.

In the main program I define an object, "sDA", based on Field.DA.

In a Class of the main program I create a NEW instance of sDA. When I try to assign the contents of a public am_towers UDT to sDA.towers I get the mismatch error.

amtools and field compile just fine. The error occurs when I try to compile the local program.

A snippet of my code follows:
'Public Class Module #1, "amTools"
Option Explicit
Public Type am_towers
elec_hgt_deg As Variant
field_ratio As Variant
orientation_deg As Variant
phasing_deg As Variant
spacing_deg As Variant
top_loaded_switch As Variant
topload_a As Variant
topload_b As Variant
topload_c As Variant
topload_d As Variant
tower_num As Variant
tower_ref_switch As Variant
topload_apparent_hgt As Variant
End Type

'Public Class Module #2 "amField.DA"
Option Explicit
Private lTow() As amtools.am_towers
Public Property Let Towers(ByRef vNewValue() As amtools.am_towers)
Dim i As Long, lb As Long, ub As Long
lb = LBound(vNewValue)
ub = UBound(vNewValue)
ReDim lTow(lb To ub)
For i = lb To ub
lTow(i) = vNewValue(i)
Next i
End Property
Public Property Get Towers() As amtools.am_towers()
Dim i As Long, iL As Long, iu As Long
Dim vR() As amtools.am_towers
iL = LBound(lTow)
iu = UBound(lTow)
ReDim vR(iL To iu)
For i = iL To iu
vR(i) = lTow(i)
Next i
Towers = vR
End Property

Local Code Module:
Public AmTowers() As amtools.am_towers
Public sDA As amField.DA

Local Class Module:
Public Sub LoadStation(Towers() As amtools.am_towers)
AmTowers() = Towers()
Set sDA = Nothing
Set sDA = New amField.DA
sDA.Towers() = AmTowers() <-- Compile Error: ByRef argument type mismatch!!!

End Sub
Sign In or Register to comment.