| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2538 人关注过本帖
标题:错误应输入 class、delegate、enum、interface 或 struct
只看楼主 加入收藏
li395833074
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2009-6-29
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:6 
错误应输入 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;
              }
               
        }
}
高手看看哪里出错了 啊
我是新手 ,下午想感觉下  ,照个书上抄的都出错  
搜索更多相关主题的帖子: interface delegate enum struct class 
2009-07-16 18:22
slb00814
Rank: 2
来 自:黑龙江
等 级:论坛游民
帖 子:41
专家分:47
注 册:2008-11-2
收藏
得分:3 
仔细描述一下错误情况啊。

曾经沧海,除却巫山。
2009-07-16 19:19
野比
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:1627
专家分:516
注 册:2007-5-24
收藏
得分:3 
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();
        }

女侠,约吗?
2009-07-16 19:29
乖老鼠
Rank: 5Rank: 5
来 自:四川省
等 级:职业侠客
威 望:2
帖 子:434
专家分:394
注 册:2008-9-8
收藏
得分:3 
你构造函数上面多了一个括号

转眼就从编程菜鸟混成了半灌水
2009-07-17 13:45
daliuyin
Rank: 2
等 级:论坛游民
帖 子:10
专家分:33
注 册:2009-7-13
收藏
得分:3 
就是括号的问题,注意括号的作用域!
2009-07-20 16:17
onionforce
Rank: 1
等 级:新手上路
帖 子:8
专家分:3
注 册:2009-7-7
收藏
得分:3 
加了那个括号之后,namespace就从构造函数之后结束了,剩下的内容Visual Studio就不会识别出来了
2009-08-05 09:31
田代印
Rank: 2
来 自:山东
等 级:论坛游民
帖 子:16
专家分:10
注 册:2009-8-3
收藏
得分:3 
恩,是的,就是多了个括号啦!
2009-08-06 14:22
快速回复:错误应输入 class、delegate、enum、interface 或 struct
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031790 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved