Calculator Community > Pokemon Red

Pokemon Stats Generator

<< < (3/3)

Magic Banana:
The code seems to change nothing at all. The sorted property for the combobox just doesn't do what we are trying to do here. Name changes only. Plus, if an item is currently selected when sorting it, the program crashes. I've even reset the selected index and it still happens. That, plus it never 'unsorts' it after it has been sorted means that the combobox sort isn't the best way to do this. I think I may have an idea though ...

BuckeyeDude:
Ah my bad, I set this up horribly. A couple things had to be changed to fix this. One in addition to overriding the Equals() method, the ToString() method needed to be overridden too (I thought I had already done this).

--- Code: --- public override string ToString()
        {
            return name;
        }
--- End code ---
Then in the New_Move() method, comboBox.Item.Add() needs to add the move, not just the name.

--- Code: ---allMoves[index] = new Move(index, name, type, pp, power, accuracy);
            movesComboBox.Items.Add(allMoves[index]);
--- End code ---
Finally you need to call InitMoves() whenever you resort the list so they are added properly. There is a better way to do this, which I can explain if you want. Also make sure you add a comboBox.Items.Clear() in InitMoves() so you don't keep adding to the items already there.

Magic Banana:
Well, for now I just took the cheap and ridiculously repetitive path by just making a second list.  ;D

I'm going to be busy for a while today so this will have to do until I hash out the details. You can feel free to work on it if you want, seeing as it's your program. I'm pretty sure it will convert from 2008 to 2010 pretty smoothly, especially if I was able to make it backwards compatible.

Navigation

[0] Message Index

[*] Previous page

Go to full version