Public Structure PKMN
Public name as String
Public pkmnMoves as Collection '(or List, etc)
End Structure
Public Structure Move
Public name as String
Public damage as int
End Structure
Public Bulbasaur as new PKMN
Public pkmnMoves as new Collection '(because Public Bulbasaur.pkmnMoves As New Collection doesn't work)
Public Struggle as new Move
Public Sub AddMove()
Bulbasaur.name = "Bulbasaur"
Struggle.name = "Struggle"
Struggle.Damage = 35
Bulbasaur.pkmnMoves.Add(Struggle, 0)
End Sub
Placed into a simple button, AddMove() returns the error:
"An unhandled exception of type 'System.NullReferenceException' occurred in PokémonRainbow.exe
Additional information: Object reference not set to an instance of an object."
I have tried a collection, and specifiying a Key, I have tried a list, and adding an item, and nothing seems to work. I get the same error no matter what I do, and the only way I can add an object is outside of the structure, which does me absolutely no good as it's not linked to that particular Pokémon. I'm hoping there is an easy solution tp this, if this just isn't possible, then I suppose I'll have to look into some kind of Array or Linked List, because otherwise there is no way to keep track of which Pokémon knows what moves, and whether or not you've learned a new/changed a move.

New Topic/Question
Reply



MultiQuote




|