|
-
Feb 9th, 2003, 12:02 PM
#1
Thread Starter
Addicted Member
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?
-
Feb 9th, 2003, 12:12 PM
#2
What are BackPack, Slot and Stats? Are they Forms? Control Arrays?
-
Feb 9th, 2003, 12:14 PM
#3
Fanatic Member
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
-
Feb 9th, 2003, 01:07 PM
#4
Thread Starter
Addicted Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|