Pavle_nis

C++ Quiz Form2

Oct 19th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication3
  12. {
  13.     public partial class Form2 : Form
  14.     {
  15.         int m, s;
  16.         public Form2()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.         private void button1_Click(object sender, EventArgs e)
  21.         {
  22.          //   MessageBox.Show("Answer is not correct");
  23.             this.Visible = true;
  24.             Form2 form2 = new Form2();
  25.             DialogResult dialog =MessageBox.Show("Answer is not correct! Do you want to play again?", "Quiz", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  26.             if(dialog == DialogResult.Yes)
  27.             {
  28.                 this.Visible = false;
  29.                 form2.Show();
  30.             }
  31.             else if(dialog == DialogResult.No)
  32.             {
  33.                 //e.Cancel = true;
  34.                 Application.Exit();
  35.             }
  36.         }
  37.  
  38.         private void button2_Click(object sender, EventArgs e)
  39.         {
  40.             //    MessageBox.Show("Answer is correct");
  41.             button2.BackColor = Color.Green;
  42.             this.Visible = false;
  43.             Form3 form3 = new Form3();
  44.             form3.Show();
  45.         }
  46.  
  47.         private void button3_Click(object sender, EventArgs e)
  48.         {
  49.             this.Visible = true;
  50.             Form2 form2 = new Form2();
  51.             DialogResult dialog = MessageBox.Show("Answer is not correct! Do you want to play again?", "Quiz", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  52.             if (dialog == DialogResult.Yes)
  53.             {
  54.                 this.Visible = false;
  55.                 form2.Show();
  56.             }
  57.             else if (dialog == DialogResult.No)
  58.             {
  59.                 //e.Cancel = true;
  60.                 Application.Exit();
  61.             }
  62.         }
  63.  
  64.         private void button4_Click(object sender, EventArgs e)
  65.         {
  66.             this.Visible = true;
  67.             Form2 form2 = new Form2();
  68.             DialogResult dialog = MessageBox.Show("Answer is not correct! Do you want to play again?", "Quiz", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  69.             if (dialog == DialogResult.Yes)
  70.             {
  71.                 this.Visible = false;
  72.                 form2.Show();
  73.             }
  74.             else if (dialog == DialogResult.No)
  75.             {
  76.                 //e.Cancel = true;
  77.                 Application.Exit();
  78.             }
  79.         }
  80.  
  81.         private void button5_Click(object sender, EventArgs e)
  82.         {
  83.             MessageBox.Show("Answer is private");
  84.             this.Visible = false;
  85.             Form3 form3 = new Form3();
  86.             form3.Show();
  87.         }
  88.  
  89.         private void button6_Click(object sender, EventArgs e)
  90.         {
  91.             button3.Enabled = false;
  92.             button4.Enabled = false;
  93.         }
  94.     }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment