private void q2Click(object sender, EventArgs e) { PictureBox imgObj = sender as PictureBox; //this.Hide(); 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); //} q3 q3Obj = new q3(); q3Obj.Show(); this.Close(); }
private void q2Click(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) { q3 form = new q3(); form.Show(); } this.Hide(); }