Class as the ListBox

How do I create a class like this:

ListBox.Cell(0,0)="Hello"

I have to create a method?

No. BUT, ListBox must be the name of an existing ListBox Control…

Stefano,

You start by adding a Listbox to your window.
The Listbox will be assigned a default name of Listbox1 (the number increments if you add more listboxes)
To add a row to that Listbox, you must use the control’s name - Listbox1

Listbox1.AddRow "Hello"

(until you add a row or folder to the listbox, you can’t access the cells).
That cell (0,0) now displays “Hello”

It is a good idea to get used to providing meaningful names for your controls. Names like lbUserList is much more obvious in your code than Listbox1.

I have a class of type WebCanvas and I want to draw a listbox in the Paint Event.

I want to recreate the function ListBox.Cell.

I created a property Array named “RowTag” of type string and a function named “RowTag”.

Writing

ListBox.Rowtag(0)="Hello"

Reading

ListBox.Rowtag(0)

to create a function as Cell do I do a multidimensional array?

You want to mimic the behaviour of the Listbox in your Canvas? That is quite a challenge. You cannot do that with only creating an array. The standard listbox is a very complex class.
You have to create a subclass of the Canvas and add methods for drawing text, lines, backgrounds, pictures. Methods for controlling the cells, the rows, the columns. That is very complex.

Why not using the WebListbox?

Because the scroll of WebListBox with 50 records on the tablet is slow

So, the category have to be Web, not General.

You could probably buy a custom listbox canvas.

Do some research and you might find one that suits your needs.

[quote=145106:@Stefano Basile]I have a class of type WebCanvas and I want to draw a listbox in the Paint Event.

I want to recreate the function ListBox.Cell.

I created a property Array named “RowTag” of type string and a function named “RowTag”.

Writing

ListBox.Rowtag(0)="Hello"

Reading

ListBox.Rowtag(0)

to create a function as Cell do I do a multidimensional array?[/quote]

I think you just asking how to implement a function/method that behave the same way, if so:

your method (row as integer, column as integer, assigns _value as variant)
than i would use a dictionary with a key that is a combined string of row and column, just like:
strKey = str(row) + “/” + str(column)

yourDictionary.value(strKey) = _value

This way you have all features of a dictionary through it