در برنامه نویسی نا گهان روی ابجکتی کلیک میکنیم و یک رویداد براش ایجاد میشه و ما ازش استفاده هم نداریم.?
مثلا فرم یک داریم
در پنجره سولوشن اکسپلورر کنار فرم یک یک مثلث کوچک است روی آن کلیک میکنیم
فایلی بنام Form1.Designer.cs وجود دارد
مثلا رویداد موس اینتر یک باتن در فرم یک را خذف کنیم
در فایل Form1.Designer.cs این کدها وجود دارند مربوط به باتن یک
//
// button1
//
this.button1.Location = new System.Drawing.Point(36, 154);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button1.MouseEnter += new System.EventHandler(this.button1_MouseEnter);
حالا برای خذف رویداد موس اینتر
this.button1.Location = new System.Drawing.Point(36, 154);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
این قسمت راپاک کردیم به همین سادگی
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button1.MouseEnter += new System.EventHandler(this.button1_MouseEnter);
یا یک زمان شی پاک شده اما هنوظ رویدادش هست و خطایی هم نمیگیره برنامه
چطوری این ها را پاک کنیم؟ آن رویداد را انتخاب میکنیم سپس دکمه دیلیت را میزنیم
در برنامه مشکل پیش نمی آید