By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,503 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

Declaring structure arrays

P: n/a
Is there a way of declaring an array of a structure where the
structure has a constructor? So if I had a structure say

Friend MyStructure
prop1 as integer
prop2 as string
sub New (p1 as integer, p2 as string)
me.prop1=p1
me.prop2=p2
End Sub
End Structure

' If I was declaring a single variable I could say:
Dim MyVar as MyStructure(100, text)

' But I can't think how to do this if I wanted:
dim MyVar(50) as MyStructure...

Is this possible/impossible?

Thanks
JGD
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

It is impossible.
But you can do Dim MyVar(50) as MyStructure and then loop thru array and
then set MyVar(index) = new MyStructure(100, text)

Regards,
Josip Habjan
"John Dann" <ne**@prodata.co.uk> wrote in message
news:b0********************************@4ax.com...
Is there a way of declaring an array of a structure where the
structure has a constructor? So if I had a structure say

Friend MyStructure
prop1 as integer
prop2 as string
sub New (p1 as integer, p2 as string)
me.prop1=p1
me.prop2=p2
End Sub
End Structure

' If I was declaring a single variable I could say:
Dim MyVar as MyStructure(100, text)

' But I can't think how to do this if I wanted:
dim MyVar(50) as MyStructure...

Is this possible/impossible?

Thanks
JGD

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.