Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 17974
Number of posts: 55343

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
ByRef argument type mismatch error in VB6. Posted by joed222 on 13 Apr 2011 at 10:58 AM
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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.