Fixed the inability to add rows by using a BindingList instead of an IEnumerable.

Signed-off-by: Melissa Avery-Weir <melissa.avery@wellsfargo.com>
This commit is contained in:
Melissa Avery-Weir
2011-09-20 15:58:31 -04:00
parent 7a40926649
commit 93ebcdd896
4 changed files with 41 additions and 72 deletions

View File

@@ -50,7 +50,8 @@ namespace d20_SRD_Spell_Lists {
ComboBox classList = (ComboBox)sender;
string charClass = classList.SelectedItem.ToString();
this.spellsDataGridView.DataSource = spells.byClass((Character.SpellCastingClasses)Enum.Parse(typeof(Character.SpellCastingClasses), charClass, true));
BindingList<Spell> spellList = new BindingList<Spell>(spells.byClass((Character.SpellCastingClasses)Enum.Parse(typeof(Character.SpellCastingClasses), charClass, true)));
this.spellsDataGridView.DataSource = spellList;
}
private void charClassComboBox_SelectedIndexChanged(object sender, EventArgs e) {
@@ -133,6 +134,7 @@ namespace d20_SRD_Spell_Lists {
private void saveToolStripButton_Click(object sender, EventArgs e) {
try {
spells.save();
character.save();
} catch (NoCharacterFileException) {
SaveFileDialog sfd = new SaveFileDialog();