//EDIT private void button_EditQuest_Click(object sender, EventArgs e) { var questName = ""; var questDescription = ""; var dataIndex = -1; if (dataGridView_Quests.SelectedRows.Count != 0 || dataGridView_Quests.SelectedCells.Count != 0) { dataIndex = dataGridView_Quests.CurrentCell.RowIndex; DataGridViewRow row = dataGridView_Quests.Rows[dataIndex]; questName = row.Cells["QuestName"].Value.ToString(); questDescription = row.Cells["QuestDescription"].Value.ToString(); } if (questName == "" || dataIndex == -1) { return; } var questID = Int32.Parse(dataGridView_Quests.Rows[dataIndex].Cells["QuestID"].Value.ToString()); QuestForm questForm = new QuestForm(questName, questDescription); if (questForm.ShowDialog() == DialogResult.OK) { EditQuest(questID, questForm.QuestName, questForm.QuestDescription); } }
//ADD private void button_AddQuest_Click(object sender, EventArgs e) { QuestForm questForm = new QuestForm(); if (questForm.ShowDialog() == DialogResult.OK) { CreateQuest(questForm.QuestName, questForm.QuestDescription); } }