โค้ด
namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string strOut = ""; if (textBox1.Text == "") { MessageBox.Show("You did not fill any scores, Please fill again", "Result of your scores", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int score = int.Parse(textBox1.Text); if (score < 0 || score > 100) { strOut = "Incorrect Input, Please fill again."; } else if (score < 50) { strOut = "Your scores are " + score + ", Grade 0 : Fail"; } else if (score < 60) { strOut = "Your scores are " + score + ", Grade 1 : Poor"; } else if (score < 70) { strOut = "Your scores are " + score + ", Grade 2 : Fair"; } else if (score < 80) { strOut = "Your scores are " + score + ", Grade 3 : Good"; } else { strOut = "Your scores are " + score + ", Grade 4 : Very Good"; } MessageBox.Show(strOut, "Result of your scores", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
Sign up here with your email
ConversionConversion EmoticonEmoticon