PDA

Click to See Complete Forum and Search --> : Public Type(array) - is it possible.


omarswan
Jan 16th, 2000, 04:20 PM
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
omarswan@yahoo.com
http://www.omarswan.cjb.net
To God Be The Glory

HarryW
Jan 16th, 2000, 04:57 PM
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.

Maartin
Jan 16th, 2000, 05:04 PM
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
dinamite@onwe.co.za
-----------------------

MartinLiss
Jan 16th, 2000, 09:51 PM
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