Solved

UDT property

Posted on 2001-09-02
5
302 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

786 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