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
VulpesPosted Mar 24, 2012, 9:08 AM
irwin youngPosted Mar 24, 2012, 8:14 AM
the ControlForms.Designer.cs which include the 'this.' line and the
Program.cs which includes the handler?
dont you integrate them to 1 file?
VulpesPosted Mar 19, 2012, 7:29 AM
irwin youngPosted Mar 19, 2012, 7:16 AM
private void button2_Click(object sender, EventArgs e)
{
}
and the following line does not appear:
this.button2second.Click += new System.EventHandler(this.button2_Click);
FroglegPosted Mar 18, 2012, 2:54 PM
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 youngPosted Mar 18, 2012, 11:14 AM
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
FroglegPosted Mar 17, 2012, 4:05 PM