By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,373 Members | 1,792 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,373 IT Pros & Developers. It's quick & easy.

Dim question

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
Nov 21 '05 #2

P: n/a
"Jm" <ja*****@ihug.com.au> schrieb:
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'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.