Taien
Member
- Joined
- Oct 8, 2008
- Messages
- 9
- Programming Experience
- 1-3
I'm fairly new to VB and I am making a game as part of my portfolio project in a class. I'm having some trouble with array declaration though. Here's my code:
I have option explicit on and option strict on. When I type that second line in the code box, I get "Declaration Expected" in the error box. If I try using the following, I get "Explicit initialization is not permitted for arrays declared with explicit bounds."
This is all within a class. Do I need to declare public arrays outside the class? Because it seems to work fine if I declare them within a sub, but then I can't make them public, of course. Grrr.
Help!
P.S. I intend to declare one hundred and one "false" values for the variable initially, but I can't even get this to work.
VB.NET:
Public varSkillLearnedArray(100) As Boolean
varSkillLearnedArray() = {True,true,true}
I have option explicit on and option strict on. When I type that second line in the code box, I get "Declaration Expected" in the error box. If I try using the following, I get "Explicit initialization is not permitted for arrays declared with explicit bounds."
VB.NET:
Public varSkillLearnedArray(100) As Boolean = {True, True, True}
This is all within a class. Do I need to declare public arrays outside the class? Because it seems to work fine if I declare them within a sub, but then I can't make them public, of course. Grrr.
Help!
P.S. I intend to declare one hundred and one "false" values for the variable initially, but I can't even get this to work.