i have already existing program which contain form and handle line like:
this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint);
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
i saw that whenever i add a new component like button a new event line is added like:
this.button1first.Click += new System.EventHandler(this.button1_Click);
when i created a new winform project i saw that such handle lines were not created when i added a button
how can i cause the ide to add automaticly those event lines
this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint);
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
i saw that whenever i add a new component like button a new event line is added like:
this.button1first.Click += new System.EventHandler(this.button1_Click);
when i created a new winform project i saw that such handle lines were not created when i added a button
how can i cause the ide to add automaticly those event lines

FroglegRank #1,020 · 1.9K reputationPosted Mar 17, 2012, 12:05 PM EDT
irwin young7 reputationPosted Mar 18, 2012, 7:14 AM EDT
a lines like those appear:
//
// button2second
//
this.button2second.Location = new System.Drawing.Point(635,
378);
this.button2second.Name = "button2second";this.button2second.Size = new System.Drawing.Size(68, 35);
this.button2second.TabIndex = 31;this.button2second.Text = "button2second";
this.button2second.UseVisualStyleBackColor = true;
this.button2second.Click += new System.EventHandler(this.button2_Click);
but on a new project i opened only this function appears:
private void button2_Click(object sender, EventArgs e)
{
}
may be thre is a way to make the specific document add those lines automatically whenever the button is being added
FroglegRank #1,020 · 1.9K reputationPosted Mar 18, 2012, 10:54 AM EDT
Using the toolbox
Create a form, open the toolbox - drag a button onto form
Double click the button and the code window will open with the button click event added to it
irwin young7 reputationPosted Mar 19, 2012, 3:16 AM EDT
private void button2_Click(object sender, EventArgs e)
{
}
and the following line does not appear:
this.button2second.Click += new System.EventHandler(this.button2_Click);
VulpesRank #55 · 29.2K reputationPosted Mar 19, 2012, 3:29 AM EDT
irwin young7 reputationPosted Mar 24, 2012, 4:14 AM EDT
the ControlForms.Designer.cs which include the 'this.' line and the
Program.cs which includes the handler?
dont you integrate them to 1 file?
VulpesRank #55 · 29.2K reputationPosted Mar 24, 2012, 5:08 AM EDT