Results 1 to 3 of 3

Thread: Type in Type

  1. #1
    Guest
    What I'm trying to do is something like this:
    Code:
    Public Type A1
        SubItem1 As String
        SubItem2 As String
        SubItem3 As String
    End Type
    
    Public Type A2
        Item1 As A1
    End Type
    Obviously it doesn't work (Forward reference to user-defined type error). Is there a way of doing it (use an user-defined type in another user-defined type?)
    Thanks for ANY help

  2. #2
    Member
    Join Date
    May 2000
    Posts
    63
    I got your code to work in VB6 Enterprise. What version are you using?

  3. #3
    Guest

    How stupid can I be???

    I have VB 6 ent also and I finally figured out how to use this code. What I had in my program was:
    Code:
    Public Type A2
        Item1 As A1
    End Type
    
    Public Type A1
        SubItem1 As String
        SubItem2 As String
        SubItem3 As String
    End Type
    ...and it causes "Forward Reference error". I can't believe that all I had to do is to switch places of the A1 and A2. It reminds me of old TurboPascal days where you were not able to use a function A from function B if the fA was declared later than fB.
    Thanks for telling me it worked. After that I've figured it out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width