private void Edit() { if (ProperQuestion()) { ThisQuiz.EditItem(listBoxQuestions.SelectedIndex, CreateObject()); Clear(); } }
private void Add() { if (ProperQuestion()) { ThisQuiz.Record(CreateObject()); listBoxQuestions.Items.Add((listBoxQuestions.Items.Count + 1).ToString()); Clear(); } }
private void Delete() { ThisQuiz.RemoveItem(listBoxQuestions.SelectedIndex); for (int i = listBoxQuestions.SelectedIndex; i < listBoxQuestions.Items.Count - 1; i++) { listBoxQuestions.Items[i + 1] = (i + 1).ToString(); } listBoxQuestions.Items.RemoveAt(listBoxQuestions.SelectedIndex); }
private void listBoxQuestions_DoubleClick(object sender, EventArgs e) { Question temp = ThisQuiz.Load(listBoxQuestions.SelectedIndex); if (temp != null) { textBoxQuestion.Text = temp.questionText; AnswerLoad(answer1, temp.properAnswers[0], temp.answers[0]); AnswerLoad(answer2, temp.properAnswers[1], temp.answers[1]); AnswerLoad(answer3, temp.properAnswers[2], temp.answers[2]); AnswerLoad(answer4, temp.properAnswers[3], temp.answers[3]); } }
private void SaveToXML() { if (ProperFileName()) { SaveXML.SaveData(ThisQuiz.Value(), @".\" + textBoxName.Text + ".xml"); ThisQuiz.ClearThemAll(); listBoxQuestions.Items.Clear(); errorProviderFName.Clear(); } else { errorProviderFName.SetError(labelQName, "Give proper filename!"); } }