Valhalla Legends Archive

Programming => General Programming => Topic started by: Atom on February 24, 2003, 02:49 AM

Title: Vb Question
Post by: Atom on February 24, 2003, 02:49 AM
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.
Title: Re: Vb Question
Post by: Grok on February 24, 2003, 03:24 AM
Public MyArray() As String
Title: Re: Vb Question
Post by: Spht on February 24, 2003, 04:36 AM
Quotelol....

What's the point in replying just to laugh? Ideally you'd keep that to yourself.
Title: Re: Vb Question
Post by: Atom on February 24, 2003, 10:11 AM
how is that an array of a public type? thats an array of a string...
Title: Re: Vb Question
Post by: Etheran on February 24, 2003, 10:57 AM
Quotehow is that an array of a public type? thats an array of a string...
A string is a type, therefore, a public string is a public type.
Title: Re: Vb Question
Post by: Atom on February 24, 2003, 11:13 AM
you know thats not what i meant, u can make your own types in vb, but forget it
Title: Re: Vb Question
Post by: Etheran on February 24, 2003, 11:19 AM
Well, how Grok explained it is how you would do it I imagine.

Public MyArray() as MyType
Title: Re: Vb Question
Post by: Grok on February 24, 2003, 12:55 PM
Well there's Enums and Types...

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

Any questions, just ask.
Title: Re: Vb Question
Post by: iago on February 24, 2003, 01:04 PM
Can you do Unions in vb?
Title: Re: Vb Question
Post by: Yoni on February 24, 2003, 01:35 PM
QuoteCan you do Unions in vb?
Of course not! What, you think VB gives users any control over the variables' placement in memory?
Title: Re: Vb Question
Post by: Atom on February 24, 2003, 05:06 PM
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)
Title: Re: Vb Question
Post by: Banana fanna fo fanna on February 25, 2003, 11:45 AM
Haze:

You are not allowed to laugh at other people's questions.