Solved

UDT property

Posted on 2001-09-02
5
300 Views
Last Modified: 2006-11-17
I would like to return a udt as a property for a class.   Is it possible?  I dont want to make another class because this class has many properties that must be this type.
0
Comment
Question by:vblogic
5 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6449580
I think that you need to return as variant, but working with it like an UDT.
0
 
LVL 1

Author Comment

by:vblogic
ID: 6449588
Richie,
Even if I declare as Variant, it gives me compile error because it knows I am trying to return a UDT.

Example:

Private m_udtSample As UDTSample

Public Property Get SampleProperty() As Variant
   SampleProperty = m_udtSample
End Property
0
 

Accepted Solution

by:
ruchir_khanduri earned 100 total points
ID: 6450074
A User Defined Type (UDT) allows the programmer to create a complex data type by combining the Visual Basic data types like String, Double, and Integer. The following code defines a Customer data type made up of string, numeric, and date values:

Type Customer
   Name As String
   CreditLimit As Currency
   BirthDate As Date
End Type

Public Function UDTRoutine (CustomerData As Customer) _
As Customer

    A developer could call the function like this, both passing a UDT and accepting the function's return value into a UDT variable:

Dim udtData As Customer
udtData.Name = "Peter Vogel"
udtData.BDate = "31/05/53"
udtData.CreditLimit = 200

udtData = obj.UDTRoutine(udtData)

    In Visual Basic 5.0, you can not pass or return UDT's to methods and some containers will not allow you to use UDT's.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7087199
Hi vblogic,
You've requested to delete this question, but its status has remained as 'Pending Delete' because one or more comments have been added.  Normally, the only way to fully delete such a Question is to post a message to Community Support and ask for assistance.

EE is making a one-time database sweep to purge the Pending Delete Questions automatically.  During this sweep:

    vblogic -- To allow the deletion to proceed:  Do nothing.
    EXPERTS -- Please DON'T POST a comment except to contest this deletion.

In the future, please refer to http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp#8 for instruction on deleting questions.

DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7108268
Finalized by Moondancer - EE Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now