Is it possible to declare with an index?
Dim tile(index) as long
Printable View
Is it possible to declare with an index?
Dim tile(index) as long
you can declare with a constant - if you want to declare with a variable you need to:
dim X() as long
redim X(index)
And how do I declare it with a constant?
Quote:
Originally Posted by haruki
VB Code:
'form level Private Const MYINDEX = Whatever 'event level Const MYINDEX = Whatever
dim i(5) as long
Hm.. So if I want to use this for example how do I need to declare?
VB Code:
For i = 1 to 10 Tile(i) = LoadGraphicDC(App.Path & "\tile" & i & ".bmp") Next i
Dim Tile(10) as long
UH?
I dont understand, give me the whole idea. How do I need to declare from scratch to get that to work.
VB Code:
Dim Tile(10) As Long Dim i As Long For i = 1 To 10 Tile(i) = LoadGraphicDC(App.Path & "\tile" & i & ".bmp") Next i
and if i want to do
VB Code:
Tile(1) = "1adf234" Tile(3) = "43adfadf"
Why add 10? like you did "dim Tile(10)"?
I did Dim Tile(10) because you gave your example of having i = from 1 to 10.
The statement Dim Tile(10) as long, creates an array with elements from 0 to 10. If you only need 3 items use Dim Tile(3) as long.
You only need to declare the array to be the size you need.
Clear??
R