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 窗体事件Load_Click_Closing
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        private void Form1_Load(object sender, EventArgs e)
        {
            MessageBox.Show("已经登陆");
        }
        private void Form1_Click(object sender,EventArgs e)
        {
            MessageBox.Show("已经单击事件");
        }
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult dr = MessageBox.Show("是否关闭事件","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Warning);
            if (dr == DialogResult.Yes)
            {
                e.Cancel = false;
            }
            else
            {
                e.Cancel = true;
            }
        }
    }
}
出现的错误在在Form1.Designer.cs中this.Load += new System.EventHandler(this.Form1_Load);
我不理解是什么意思

解决方案 »

  1.   

    this.Load += new System.EventHandler(this.Form1_Load)
    就是给窗体的Load事件绑定到Form1_Load这个函数上
      

  2.   

    你没有定义Form1_Load方法,这个方法通常是响应load事件,
      

  3.   

    你把事件方法删除了,但是design.cs里面的
    this.Load += new System.EventHandler(this.Form1_Load);没有删除。
    双击错误提示,打开design.cs文件,把它也删除掉。
      

  4.   

    我想实现的是当我关闭Form1窗体时弹出来一个MessageBox,提示“是否关闭”,有“是与否”两个选择按钮,选择“是”的话就关闭窗体,选择“否”的话就不关闭窗体。
      

  5.   

    那个是在this.form1_close中添加一个新的form
      

  6.   

    你没在前台加入 Form1_Load 事件吧
      

  7.   

    1.Form1.Designer.cs 与Form1.cs的命名空间不一致(有时手动更改或复制其它地方的代码所致)
      

  8.   

    最简单的方法,再设计界面上双击FORM跳转到代码界面,在调试就可以了