Anyway, I have a list of 'Trucks' (objects of the truck class) and I can't seem to add anything to it. Here's the code:
Code: Select all
Dim i As Integer = 0
While i < 6
'this will make us five trucks :)
Dim newTruck As New Truck
AddHandler Me.Paint, AddressOf lstTrucks(i).PaintTruck
i += 1
I've done something almost exactly the same in C#, I don't know why this doesn't work. I'm getting a NullReferenceException error when I try compile. This code is executed in a form's Load event.
The Truck class isn't an empty one.
Any help? I'm sure it's just a VB quirk I don't know about.