错误应输入 class、delegate、enum、interface 或 struct
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace jiegou
{
public partial class Form1 : Form
{
public struct students
{
public string numberID;
public string name;
public int age;
public float score;
}
}
}
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Students stu1,stu2,stu3,stu4;
stu1.numberID = "20061000";
stu1.name = "杨迪";
stu1.age = 18;
stu1.score = 72f;
stu2.numberID = "20061001";
stu2.name = "周娟";
stu2.age = 20;
stu2.score = 68f;
stu3.numberID = "20061002";
stu3.name = "孙淑";
stu3.age = 18;
stu3.score = 70f;
stu4.numberID = "20061003";
stu4.name = "杨风";
stu4.age = 19;
stu4.score = 66f;
string number =
switch(number)
{
case"20061000";
{
this.textBox1.Text = stu1.numberID;
this.textBox2.Text = stu1.name;
this.textBox3.Text = stu1.age.ToString();
this.textBox4.Text = stu1.score.ToString();
break;
}
case"20061001";
{
this.textBox1.Text = stu2.numberID;
this.textBox2.Text = stu2.name;
this.textBox3.Text = stu2.age.ToString();
this.textBox4.Text = stu2.score.ToString();
break;
}
case"20061002";
{
this.textBox1.Text = stu3.numberID;
this.textBox2.Text = stu3.name;
this.textBox3.Text = stu3.age.ToString();
this.textBox4.Text = stu3.score.ToString();
break;
}
case"20061003";
{
this.textBox1.Text = stu4.numberID;
this.textBox2.Text = stu4.name;
this.textBox3.Text = stu4.age.ToString();
this.textBox4.Text = stu4.score.ToString();
break;
}
}
}
高手看看哪里出错了 啊
我是新手 ,下午想感觉下 ,照个书上抄的都出错