Passing User Defined Data Type Array as argument to a public function in class module

Posted on 2003-03-24
Medium Priority
Last Modified: 2010-04-17
We have a public user defined data type

Public Type AttribInfo
    sName As String
    sBaseName As String
    lType As Long
End Type

which is defined in a private module.

Now we create an array of this defined data type i.e.

Dim tAttrInfo(10) As AttributeInfo

and want to pass this as argument to a function in a class as follows:

Public Function GetAttributeNames(ByVal sElementName As String, ByRef strAttribNames() As AttributeInfo) As Long

At this point VB gives an error

Can any body tell me the way to do it ?
Question by:vipingoel
  • 3
LVL 30

Expert Comment

by:Mayank S
ID: 8200575
>> Public Type AttribInfo

>> Dim tAttrInfo(10) As AttributeInfo

>> ByRef strAttribNames() As AttributeInfo

Now, do you want me to point the error here or have you already done it?

The type-name os AttribInfo and your variables are of the type AttributeInfo!


Author Comment

ID: 8215582
In the Question please take the type name as AttributeInfo not as AttribInfo. It is typo mistake and even then the same problem persists.
LVL 30

Accepted Solution

Mayank S earned 300 total points
ID: 8215724
Try putting the Type definition not in a form's declarations but in a Module and define it as Global.


Expert Comment

ID: 9446828
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
LVL 30

Expert Comment

by:Mayank S
ID: 9451953
Recommendation: Accept mayankeagle's comment as answer.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Loops Section Overview

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question