Results 1 to 4 of 4

Thread: Public Type(array) - is it possible.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Post

    Is it possible to make a public array of TYPE.

    example. I created the followin type and placed it inside a module.

    Public Type CUsers
    UserName As String
    IP_Address As String
    End Type

    On a Form I tried the following :
    Dim Students as Public CUsers

    I got an error.


    Is there a way to work around that?



    ------------------
    OmarSwan
    [email protected]
    http://www.omarswan.cjb.net
    To God Be The Glory

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827

    Post

    I thought the syntax for declaring a public variable like this was:

    Public Students as CUsers

    And I'm pretty certain you can make an array of a user-defined type. I've done it before.

  3. #3
    Lively Member Maartin's Avatar
    Join Date
    Jan 2000
    Location
    Benoni, Gauteng, South-Africa
    Posts
    99

    Post

    Yes it is possible but check your declarations. It should read something like this.

    Public Type CUsers
    UserName As String
    IP_Address As String
    End Type

    Then in a Module.
    Global udtUsers() as CUsers.
    or
    Public udtUsers() as CUsers.

    Now when you add items to the array use the redim preserve.

    I hope this helps.

    ------------------
    -----------------------
    Maartin
    [email protected]
    -----------------------

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    Just remove the "Public" portion of your Dim when you want to use your user defined type, so the following works:

    Dim Students as CUsers

    ------------------
    Marty

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