New Variable with properties

please, I need variable “Items()”, where will be variable .name, .level and so on.
redim Items(2)
Items(0).name = “Box1”
Items(0).level = 1
items(1).name = “Box 2”

How should I declare it? I tried create in webpage1 in properties Items() as object and in Attributes I add name and level, but it didn’t work…

If you need an object, then make a class. If you need something more simple then use a dictionary.

I don’t need an object. I don’t know, how can I do it? I looked on dictionary and I tried:

→ NilObjectException

Why not an object?
A dictionary could be useful if every item could have different attributes, otherwise an object is exactly what you wrote in your example.

However, both for an object and for a dictionary if you simply redim your array every item will be nil
maybe is better (or is what you want to do):

dim items() as Dictionary for i as integer=0 to <howManyYouNeed> items.append new dictionary next

now you can access your dictionary

items(0).Value("name") = "box1" items(1).Value("name") = "box2" items(0).Value("level") = "1"

For the object solution:

class myObject property name as string property level as integer

dim items() as myObject for i as integer=0 to <howManyYouNeed> item.append new myObject next
now you can access your object

Items(0).name = "Box1" Items(0).level = 1 items(1).name = "Box 2"

Ou, that’s work very good. Thank you very much! :slight_smile: