Dim question

  • Thread starter Thread starter Jm
  • Start date Start date
J

Jm

Hi all

Is it possible to use DIM with an existing variable. By this i mean for
example: (Im just guessing on the syntax)

Dim MyNum as Int

MyNum = 5

Dim Lst(MyNum) as Listview

Thanks
 
JM,
Dim MyNum as Int
MyNum = 5
Dim Lst(MyNum) as Listview

This are 6 references (placeholders) to create a new listview in.

It has in this way not much sense because you can only redimension an array.

It can be useful as this

dim MyNum as integer = MyotherArray.lenght
Dim Lst(MyNum) as Listview

but that is the same as

Dim Lst(MyotherArray.lenght) as Listview

I hope this helps?

Cor
 
Jm said:
Is it possible to use DIM with an existing variable. By this i mean for
example: (Im just guessing on the syntax)

Dim MyNum as Int

MyNum = 5

Dim Lst(MyNum) as Listview

Yes, this will work, but notice that it will create an array with 6
elements, with indices 0, ..., 5, each of the elements being initialized
with 'Nothing'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top