PRB: Error When You Access an Array Field of a .NET Structure from COM (316936)
The information in this article applies to:
- Microsoft .NET Framework 1.1
- Microsoft .NET Framework 1.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
This article was previously published under Q316936 SYMPTOMS When you access an Array field of a structure that is defined in .NET from inside a COM
DLL, you may receive the following error message: "An
unhandled exception of type 'System.ArgumentException' occurred in
ProjectName"
Additional information:
Wrong number of arguments or invalid property assignment.
CAUSE Because of the late-bound method that is used in this case,
the Visual Basic 6.0 runtime cannot get the type information for the Array field that you are attempting to access. RESOLUTION Before you invoke the Array field of the structure, assign the array to another Variant variable. The following sample resembles the modified code:
temp = Arg1.Ary
MsgBox temp(arg2, arg3)
NOTE: If you use Option Explicit, you must declare the variable temp. Refer to the "More Information" section of this article for the
complete code list. STATUSThis
behavior is by design.
Modification Type: | Major | Last Reviewed: | 5/13/2003 |
---|
Keywords: | kbprb KB316936 |
---|
|