Valhalla Legends Forums Archive | General Programming | Vb Question

AuthorMessageTime
Atom
Is there any way that I can make an Array of a Public Type?
If i could it would make my project a lot easier. Code Plz.
February 24, 2003, 8:49 AM
Grok
Public MyArray() As String
February 24, 2003, 9:24 AM
Spht
[quote]lol....[/quote]

What's the point in replying just to laugh? Ideally you'd keep that to yourself.
February 24, 2003, 10:36 AM
Atom
how is that an array of a public type? thats an array of a string...
February 24, 2003, 4:11 PM
Etheran
[quote]how is that an array of a public type? thats an array of a string...[/quote]
A string is a type, therefore, a public string is a public type.
February 24, 2003, 4:57 PM
Atom
you know thats not what i meant, u can make your own types in vb, but forget it
February 24, 2003, 5:13 PM
Etheran
Well, how Grok explained it is how you would do it I imagine.

[code]Public MyArray() as MyType[/code]
February 24, 2003, 5:19 PM
Grok
Well there's Enums and Types...

[code]Public Enum STATE_CODE
   AK
   AL
   GA
   FL
   'etc
End Enum

Public Type MyNewType
   FirstName As String
   LastName As String
   Address1 As String
   Address2 As String
   State as STATE_CODE
End Type
Public Locator() As MyNewType   'array of custom public type

Sub Main
   ReDim Locator(0 to 0)
   Locator(0).FirstName = "Atom"
   Locator(0).LastName = "Ant"
   Locator(0).Address1 = "123 Anystreet"
   Locator(0).State = FL
End Sub[/code]

Any questions, just ask.
February 24, 2003, 6:55 PM
iago
Can you do Unions in vb?
February 24, 2003, 7:04 PM
Yoni
[quote]Can you do Unions in vb?[/quote]
Of course not! What, you think VB gives users any control over the variables' placement in memory?
February 24, 2003, 7:35 PM
Atom
ahhh  see my problem was that i was thinking, that if i did that i would be declaring the variable twice, when actually the first time i was declaring the type and not the variable, thanks grok 8)
February 24, 2003, 11:06 PM
St0rm.iD
Haze:

You are not allowed to laugh at other people's questions.
February 25, 2003, 5:45 PM

Search