Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using same user data type in different class modules

Status
Not open for further replies.
Oct 5, 1999
105
GB
I have several different classes that access different databases.

All these classes use the same data structure to hold abbreviated details of the fields in the database which the users programs need to refer to.

This is defined as:
Code:
Type FIELD_ITEM
    Name        As String
    DefinedSize As Long
    Type        As DataTypeEnum
End Type

Type FIELDITEMS_DATA
    Table       As String
    Items       As Long
    Item()      As FIELD_ITEM
End Type

The problem is, when I use more than one of these classes in the same program, VB seems to get confused as to which one it should refer to.
e.g.
Code:
Public gtypFieldData As FIELDITEMS_DATA

I can, of course, define them more explicitly by using qualification
Code:
Public gtypFieldDataA As ClassA.FIELDITEMS_DATA
Public gtypFieldDataB As ClassB.FIELDITEMS_DATA
etc...

but VB won't let me assign these structure to each other so I can use them in generic user routines
Code:
    gtypFieldDataA = gtypFieldDataB

Without any qualification it seems to run sometimes ok under VB, but gives a complie error whenever I try to make the .exe

Is there any way round this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top