FreakBoy
Member
Hi, I'm a fairly inexperienced programmer just working on a project to teach myself some concepts and I've hit a stumbling block I can't find a solution to in any of my books, or a few hours searching through forums and with Google.
I'm replicating a game I've seen before usually called, "Light Game" or something similar. The player is confronted with a grid of "lights" that are either all off or all on and their objective is to reverse this.
By clicking on one of the "lights" the "light" clicked on and all that are adjacent invert.
I spent a lot of time thinking about how to approach the problem and have decided it would be best to redefine a checkbox control that has a Collection property containing references to the adjacent controls.
I've done this so I can have one event handler for every checkbox.
My problem is in the Collection. When I attempt to add anything to the collection (currently an Arraylist) I get a dbnull exception.
I've pulled all of the code back out and tried it without using a custom control and my coding appears to work. Its just that when the collection is used within the control it appears that the collection never becomes anything but "nothing."
I'm replicating a game I've seen before usually called, "Light Game" or something similar. The player is confronted with a grid of "lights" that are either all off or all on and their objective is to reverse this.
By clicking on one of the "lights" the "light" clicked on and all that are adjacent invert.
I spent a lot of time thinking about how to approach the problem and have decided it would be best to redefine a checkbox control that has a Collection property containing references to the adjacent controls.
I've done this so I can have one event handler for every checkbox.
My problem is in the Collection. When I attempt to add anything to the collection (currently an Arraylist) I get a dbnull exception.
I've pulled all of the code back out and tried it without using a custom control and my coding appears to work. Its just that when the collection is used within the control it appears that the collection never becomes anything but "nothing."