Guest User

Untitled

a guest
Jan 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. private void Result()
  2.  
  3. public Form1()
  4. {
  5. InitializeComponent();
  6. }
  7.  
  8. int score = 0;
  9. int totalScore = 0;
  10. private void Form1_Load(object sender, EventArgs e)
  11. {
  12. Random capital = new Random();
  13. int index = capital.Next(1, 50);
  14. string[] Country = new string[]{"Abkhazia", "Afghanistan", "Armenia", "Australia", "Azerbaijan", "Bahrain"}; //just point out there is alot more countries that are not listed
  15.  
  16. string countryName = Country[index];
  17. string imageFile = countryName + ".png";
  18. pictureBoxFlag.Image = System.Drawing.Image.FromFile(imageFile);
  19. buttonNext.Enabled = false;
  20. }
  21.  
  22. private void buttonCheck_Click(object sender, EventArgs e)
  23. {
  24. if (txtBoxAnswer.Text == "")
  25. {
  26. MessageBox.Show("Please enter a Country");
  27. }
  28. else
  29. {
  30. txtBoxAnswer.ReadOnly = true;
  31. buttonCheck.Enabled = false;
  32. buttonNext.Enabled = true;
  33. }
  34.  
  35. }
  36.  
  37. private void buttonExit_Click(object sender, EventArgs e)
  38. {
  39. this.Close();
  40. }
  41.  
  42. private void buttonNext_Click(object sender, EventArgs e)
  43. {
  44. if (txtBoxAnswer.Text == "")
  45. {
  46. MessageBox.Show("Please enter Country");
  47. }
  48. else
  49. {
  50. txtBoxAnswer.Text = "";
  51. lablelResult.Text = "";
  52. txtBoxAnswer.ReadOnly = false;
  53. buttonCheck.Enabled = true;
  54. buttonNext.Enabled = false;
  55. }
  56. }
  57.  
  58.  
  59. private void Result()
  60. {
  61. if (txtBoxAnswer.Text.ToLower() == Country[index].ToLower())
  62. {
  63. lablelResult.Text = "You are Right!";
  64. score = 10;
  65. totalScore = totalScore + score;
  66. labelScore.Text = ("score is: " + score + "nTotal score is: " +totalScore);
  67. }
  68. else
  69. {
  70. lablelResult.Text = "You are Wrong! Correct answer is" + Country[index];
  71. score = -10;
  72. totalScore = (totalScore + score);
  73. labelScore.Text = ("score is: " + score + "nTotal score is: " + totalScore);
  74. }
  75. }
  76.  
  77. int score = 0;
  78. int totalScore = 0;
  79. private void Form1_Load(object sender, EventArgs e)
  80. {
  81. Random capital = new Random();
  82. int index = capital.Next(1, 50);
  83. string[] Country = new string[]{"Abkhazia", "Afghanistan", "Armenia", "Australia", "Azerbaijan", "Bahrain"}; //just point out there is alot more countries that are not listed
  84.  
  85. string countryName = Country[index];
  86. string imageFile = countryName + ".png";
  87. pictureBoxFlag.Image = System.Drawing.Image.FromFile(imageFile);
  88. buttonNext.Enabled = false;
  89. }
  90.  
  91. private int score = 0;
  92. private int totalScore = 0;
  93. private int index = 0;
  94. private string[] Country = new string[]{"Abkhazia", "Afghanistan", "Armenia", "Australia", "Azerbaijan", "Bahrain"}; //just point out there is alot more countries that are not listed
  95. private void Form1_Load(object sender, EventArgs e)
  96. {
  97. Random capital = new Random();
  98. index = capital.Next(1, 50);
  99. string countryName = Country[index];
  100. string imageFile = countryName + ".png";
  101. pictureBoxFlag.Image = System.Drawing.Image.FromFile(imageFile);
  102. buttonNext.Enabled = false;
  103. }
Add Comment
Please, Sign In to add comment