private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedItem != null) { Util.ListBoxItem item = (Util.ListBoxItem)listBox1.SelectedItem; GenerateQuestion(Convert.ToInt16(item.StrQuestionNumber)); } }
private void btnRestore_Click(object sender, EventArgs e) { if (!CheckItemExist(pointernumber.ToString())) { int nQuestionNumber = pointernumber; string strQuestion; string strWongAnswer1; string strWongAnswer2; string strCorrectAnswer; GetAnswers(nQuestionNumber, out strQuestion, out strCorrectAnswer, out strWongAnswer1, out strWongAnswer2); Util.ListBoxItem item = new Util.ListBoxItem(pointernumber.ToString(), strQuestion, strCorrectAnswer, strWongAnswer1, strWongAnswer2); listBox1.Items.Add(item); } }