A
aplaxas
Hi!
"CDemo.Call" eventHandler is added to "button3.click"
Event when both button1 and button2 are clicked.
However, I want to add "cd.Call" only one time even though
I clicked both button1 and button2.
For Example,
1. Click button1
2. Click button2
3. Click button3
4. One MessageBox is shown
How to do this job?
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
public CDemo cd = new CDemo();
..
private void button1_Click(object sender, System.EventArgs
e)
{
button3.Click += new EventHandler(cd.Call);
}
private void button2_Click(object sender, System.EventArgs
e)
{
button3.Click += new EventHandler(cd.Call);
}
..
..
..
public class CDemo
{
public void Call(object sender, System.EventArgs e)
{
MessageBox.Show("Demo");
}
}
"CDemo.Call" eventHandler is added to "button3.click"
Event when both button1 and button2 are clicked.
However, I want to add "cd.Call" only one time even though
I clicked both button1 and button2.
For Example,
1. Click button1
2. Click button2
3. Click button3
4. One MessageBox is shown
How to do this job?
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
public CDemo cd = new CDemo();
..
private void button1_Click(object sender, System.EventArgs
e)
{
button3.Click += new EventHandler(cd.Call);
}
private void button2_Click(object sender, System.EventArgs
e)
{
button3.Click += new EventHandler(cd.Call);
}
..
..
..
public class CDemo
{
public void Call(object sender, System.EventArgs e)
{
MessageBox.Show("Demo");
}
}