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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses

800 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