acpig95 2017-10-18 04:02 采纳率: 0%
浏览 614

请问C#windows窗体代码哪儿错了?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace P111实验3
{
class Student
{
private string id;
private string name;
private double chinese;
private double math;
private double english;
public Student(string id,string name,double chinese,double math,double english)
{
this.id = id;
this.name = name;
this.chinese = chinese;
this.math = math;
this.english = english;
}
public string Id
{
set { this.id = value; }
get{return this.id ;}
}
public string Name
{
set { this.name = value; }
get { return this.name; }
}
public double Chinese
{
set { this.chinese = value; }
get { return this.chinese; }
}
public double Math
{
set { this.math = value; }
get { return this.math; }
}
public double English
{
set { this.english = value; }
get { return this .english ;}
}
public double Total{
get { return chinese + math + english; }
}
}
}
s.id = textBox1.Text;
s.name = textBox2.Text;
s.chinese = Convert.ToDouble(textBox3.Text);
s.math = Convert.ToDouble(textBox4.Text);
s.english = Convert.ToDouble(textBox5.Text);
n++;
label7.Text = "已成功添加一个学生!此学生信息为:";
lable7.text += "学号:" + this.id + "姓名:" + this.name + "语文成绩:" + this.chinese + "数学成绩:" + this.math + "英语成绩:" + this.english;
}
}
最后这一段代码s.id, s.name, s.chinese, s.math, s.english有错为什么呢?谢谢
错误 1 “System.Array”不包含“id”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“id”(是否缺少 using 指令或程序集引用?)

错误 2 “System.Array”不包含“name”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“name”(是否缺少 using 指令或程序集引用?)

错误 3 “System.Array”不包含“chinese”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“chinese”(是否缺少 using 指令或程序集引用?)
错误 4 “System.Array”不包含“math”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“math”(是否缺少 using 指令或程序集引用?)

错误 5 “System.Array”不包含“english”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“english”(是否缺少 using 指令或程序集引用?)

  • 写回答

2条回答

  • 椎名小由奈 2017-10-18 05:45
    关注

    你的 s 定义错了,你定义成了Array,应该是Student类

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料