Hail to All,
I need help is converting a variable declaration. In VB 6 I used to be able to create a variable like the following.
Private WatchingKey(1 to 26) as Boolean
How do I do this now in 2005 as this no longer works.
Thanks for all your help.
Printable View
Hail to All,
I need help is converting a variable declaration. In VB 6 I used to be able to create a variable like the following.
Private WatchingKey(1 to 26) as Boolean
How do I do this now in 2005 as this no longer works.
Thanks for all your help.
I am not sure what is that supposed to do. Is it an array? of 26 elements starting with 1 instead of zero?
The simplest thing would be
vb Code:
Private WatchingKey(25) As Boolean
which will give you 0 - 25 (or 26 elements)
Thanks. Just wanted it to start at 1 not 0 but just have to add an extra elemlnt.
Arrays all start with 0 in .NET. Just add a +1 to the variable you are using as such.
Private WatchingKey(25) As Boolean
Dim i as integer = 0
'...
WatchingKey(i + 1) = "Blah"
Don't ever add an extra element to arrays like that. As Rob suggests, arrays are zero-based and you should use them as such. There's never a need for a hack like that. It's all handled smoothly with properly written code.Quote:
Originally Posted by Mythos44