private void QuizForm_Load(object sender, EventArgs e) { XmlMethods.LoadXDocumnet(file); //Load the document (file creating remove when catch exception). setValuesToControl(0); //set the first question fro file lblDescription.Text = XmlMethods.getQuention(file, Des, "1"); lblQRemaining.Text = "Question NO. : " + 1 + "/" + ID.Length; //set the first question number }
} //check the ans by comparing it with the ans private void setValuesToControl(int IDs) { lblQuestion.Text = ID[IDs] + ".\n" + XmlMethods.getQuention(file, question, ID[IDs]); radioOption1.Text = XmlMethods.getQuention(file, Op_1, ID[IDs]); radioOption2.Text = XmlMethods.getQuention(file, Op_2, ID[IDs]); radioOption3.Text = XmlMethods.getQuention(file, Op_3, ID[IDs]); radioOption4.Text = XmlMethods.getQuention(file, Op_4, ID[IDs]); lblAns.Text = XmlMethods.getQuention(file, Ans, ID[IDs]); lblDescription.Text = XmlMethods.getQuention(file, Des, ID[IDs]); } //set all ans and question to their control
/*----------------------End Buttons Action-----------------------*/ /*-------------------------Methods-------------------------*/ private void setValuesToControl(int IDs) { isAnsShown = false; lblQuestion.Text = ID[IDs] + ".\n" + XmlMethods.getQuention(file, question, ID[IDs]); radioOption1.Text = XmlMethods.getQuention(file, Op_1, ID[IDs]); radioOption2.Text = XmlMethods.getQuention(file, Op_2, ID[IDs]); radioOption3.Text = XmlMethods.getQuention(file, Op_3, ID[IDs]); radioOption4.Text = XmlMethods.getQuention(file, Op_4, ID[IDs]); val1 = Convert.ToInt32(XmlMethods.getQuention(file, OpVal_1, ID[IDs])); val2 = Convert.ToInt32(XmlMethods.getQuention(file, OpVal_2, ID[IDs])); val3 = Convert.ToInt32(XmlMethods.getQuention(file, OpVal_3, ID[IDs])); val4 = Convert.ToInt32(XmlMethods.getQuention(file, OpVal_4, ID[IDs])); } //set all ans and question to their control
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { string IDs = (string)listBox1.SelectedItem; toolTip1.Show(string.Format("Question No {0}\n{1}\n{2}\n{3}\n{4}\n{5}\nAns: {6}", IDs, XmlMethods.getQuention(filename, "Qs", IDs), XmlMethods.getQuention(filename, "Op1", IDs), XmlMethods.getQuention(filename, "Op2", IDs), XmlMethods.getQuention(filename, "Op3", IDs), XmlMethods.getQuention(filename, "Op4", IDs), XmlMethods.getQuention(filename, "Ans", IDs) ), listBox1, 1000); }