Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Declaring a array list in a Class

Status
Not open for further replies.

angel106

Technical User
Aug 1, 2005
39
0
0
US
I'm working with an array list of some information what i did was create the object(Exported Data) which i declare all my sub and functions inside. I wan tto be able to reference my arraylist but i get an error. How do you properly reference an arraylist in a class?
 
By it's identifier? Make sure the arraylist is defined within the scope of where you are trying to call it from.

for example, this won't work:
[/code]
public class Thing
public sub new
dim x as arraylist
x = new arraylist
end sub

public sub DoThing(something as object)
x.additem(something)
end sub
[/code]

but this would:

[/code]
public class Thing
dim x as arraylist

public sub new
x = new arraylist
end sub

public sub DoThing(something as object)
x.additem(something)
end sub
[/code]

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Rick I get an error on this line in VB.NET 2003
Code:
 public sub DoThing(something as object)
   [COLOR=red]x.additem(something)[/color]
 end sub

should it be
Code:
x.add(something)
without the word 'item'

DougP, MCP, A+
 
yes it should.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top