首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

错了,但不知道如何改

2013-04-02 
错了,但不知道怎么改using Systemusing System.Collections.Genericusing System.ComponentModelusing

错了,但不知道怎么改
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication11
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            System.Timers.Timer t = new System.Timers.Timer(5000);
            t.Elapsed += new System.Timers.ElapsedEventHandler(theout);
            t.AutoReset = true;
            t.Enabled = true;//总提示错误说应该输出}
            public void theout(object source , System.Timers.ElapsedEventArgs e)
            {
                this.Opacity+=0.01;
                
                

            }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Opacity= 0.0;
        }
        }
    }
}//错误2应输入类型、命名空间定义或文件尾

请帮助
[解决办法]
汗 没打} 大括号啊 你那个函数都没结束 这么低级的错误 下次自己多检查下啊
[解决办法]
是多打了个 } 吧
[解决办法]
大括号不匹配
[解决办法]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication11
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)


        {
            System.Timers.Timer t = new System.Timers.Timer(5000);
            t.Elapsed += new System.Timers.ElapsedEventHandler(theout);
            t.AutoReset = true;
            t.Enabled = true;//总提示错误说应该输出
         }
            public void theout(object source , System.Timers.ElapsedEventArgs e)
            {
                this.Opacity+=0.01;
                
                

            }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Opacity= 0.0;
        }
    }
}//错误2应输入类型、命名空间定义或文件尾

[解决办法]
大括号不匹配,编译不通过
[解决办法]
多了一个}
编译都会有提示的,你把这个去掉就可以了。
[解决办法]
括号不多,但是摆错位置了。把theout和Form_Load移动到button1_Click的事件方法外面就好了

热点排行