求高人看看错误的地方。
编了窗体程序,但是运行时出现了些问题,求高人指点迷津using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Grade
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = ("请输入分数:");
button1.Text = ("转换");
label2.Text = ("成绩等级:");
}
private void button1_Click(object sender, EventArgs e)
{
double score;
score = Convert.ToDouble(textBox1.Text);
string grade;
if (score >= 100 || score < 0)
{
textBox2.Text += ("输入的分数不合法,请核查!");
}
if (score >= 90)
grade = "优秀";
else if (score >= 80)
grade = "良好";
else if (score >= 70)
grade = "中等";
else if (score >= 60)
grade = "及格";
else
grade = "不及格";
textBox2.Text += grade.ToString();
}
}
}