private void q3Click(object sender, EventArgs e) { PictureBox imgObj = sender as PictureBox; //this.Hide(); if (imgObj.Tag == pictureBox1.Tag) { Form1.qanswers.Add(1); //this.Close(); } else if (imgObj.Tag == pictureBox2.Tag) { Form1.qanswers.Add(2); } else { Form1.qanswers.Add(3); } bool IsOpen = false; FormCollection fc = Application.OpenForms; foreach (Form f in fc) { if (f.Name == "q3") { IsOpen = true; f.Focus(); break; } } if (IsOpen == false) { q4 form = new q4(); form.Show(); } this.Hide(); }
private void q3Click(object sender, EventArgs e) { PictureBox imgObj = sender as PictureBox; if (Convert.ToInt16(imgObj.Tag) == 1) { Form1.qanswers.Add(1); //this.Close(); } else if (Convert.ToInt16(imgObj.Tag) == 2) { Form1.qanswers.Add(2); } else if (Convert.ToInt16(imgObj.Tag) == 3) { Form1.qanswers.Add(3); } //if (imgObj.Tag == pictureBox1.Tag) //{ // Form1.qanswers.Add(1); // //this.Close(); //} //else if (imgObj.Tag == pictureBox2.Tag) //{ // Form1.qanswers.Add(2); //} //else //{ // Form1.qanswers.Add(3); //} q4 q4Obj = new q4(); q4Obj.Show(); this.Close(); }