We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,394 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Creating an array of class

Hi,

How can I create an array of a class that I have declared?

I have this class named parts
with properties of frame, engine and date, and i want to know how could I store them in an array ..

thanks

2
Contributors
1
Reply
2 Hours
Discussion Span
1 Year Ago
Last Updated
2
Views
Question
Answered
jbutardo
Junior Poster in Training
74 posts since Jan 2012
Reputation Points: 8
Solved Threads: 2
Skill Endorsements: 0

dim myarray(20) as parts

This will create an array where each item can contain a reference to a part, however, the objects themselves do not exist until they are instantiated (with New). In order to actually create an array of part objects you have to do

for i as integer = 0 to 20
    myarray(i) = New parts
next
Reverend Jim
Carpe per diem
Moderator
3,623 posts since Aug 2010
Reputation Points: 563
Solved Threads: 452
Skill Endorsements: 32
Question Answered as of 1 Year Ago by Reverend Jim

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0613 seconds using 2.66MB