Solved

Array of objects

Posted on 2006-06-23
1
195 Views
Last Modified: 2010-04-23
Hi, can i do something like this?

In a module which i store all the global variables, i declare

public obj() as someClass

and on pageload based on a number generated.

for i = 0 to int_generated - 1
    obj(i) = new someClass
next

Thanks
0
Comment
Question by:jaxrpc
1 Comment
 
LVL 12

Accepted Solution

by:
omegaomega earned 500 total points
ID: 16966857
Hello, jaxrpc,

Yes, but you will need to re-dimension the array before you assign to it.  Use:

        ReDim obj(int_generated)
        For i As Integer = 0 To int_generated - 1
            obj(i) = New someClass
        Next i

Cheers,
Randy
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question