-
More Array Questions
I am having more troubles with arrays. It won't let me move text from one label to another. Here is my code for clicking the button:
Code:
For i = 0 to 9
If Slots(i) = true then
backpack.slot(i + 1).caption = stats.lblweapon.caption'Slots go from 1 to 10, so i+1 is needed
end if
next i
My declarations:
Code:
dim Slots(9) as string
And my Form_Load
Code:
for i = 0 to 9
if backpack.slot(i + 1).caption = "" then slots(i) = true 'The backpack slot is empty, so the boolen = true
end if
next i
Am I doing anything wrong?
-
What are BackPack, Slot and Stats? Are they Forms? Control Arrays?
-
watch the typing of your 'slots' array: you declare it as string, but you try to use it as boolean.
dim Slots(0 to 9) as boolean
for i = 0 to 9
if backpack.slot(i + 1).caption = "" then
slots(i) = true
end if
next i
For i = 0 to 9
If Slots(i) then
backpack.slot(i + 1).caption = stats.lblweapon.caption
end if
next i
-
So I dim it like this:
Slots(0 to 9) as Boolean?
Thanks, I think that may work. I just remembered that I am getting a type mismatch error. Dumb meh. Thanks again.