Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

UDT property

Posted on 2001-09-02
5
Medium Priority
?
311 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
[X]
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
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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

604 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