i've been been trying to decipher what is wrong with this code for some time, help would be apreciated. It is an application in visual studio 2008 with c#, when a user puts in a number, the application checks the number to make sure it is a number, then if it a valid number, then displays the correct grade according to the preset.
private void button1_Click(object sender, EventArgs e)
{
int Num = 0;
if (int.TryParse(lblLetGrade.Text, out Num) == false)
{
MessageBox.Show("Input must be a number");
//return
}
if (Num < 0 || Num > 100)
{
} MessageBox.Show("Number not valid");
//return;
if (Num >= 88 && Num <= 100)
{
lblLetGrade.Text = "A";
}
else if (Num >= 80 && Num <= 87)
{
lblLetGrade.Text = "B";
}
else if (Num >= 67 && Num <= 79)
{
lblLetGrade.Text = "C";
}
else if (Num >= 60 && Num <= 67)
{
lblLetGrade.Text = "D";
}
else (Num <= 59);
{
lblLetGrade.Text = "F";
}
help please.
thanks guys!