|
-
November 18th, 2003, 03:02 PM
#1
SendMessage?
Hi all, what is the C# equivilent of SendMessage?
right now I am doing it wrong like this:
Code:
private void Form1_Load(object sender, System.EventArgs e)
{
button1_Click( sender, e);
}
But I would like to do something like this:
Code:
private void Form1_Load(object sender, System.EventArgs e)
{
SendMessage(button1.Click,sender, e);
}
My reason for wanting to do a SendMessage is because I have multiple methods assigned to the Click event:
Code:
this.button1.Click += new System.EventHandler(this.ResetButtonColors);
this.button1.Click += new System.EventHandler(this.XferPanelControls);
this.button1.Click += new System.EventHandler(this.button1SpecificProcesses);
It would be sloppy to call all of these event handlers directly from Form1_Load and everywhere else I need to fire off an event. It could get real ugly real fast.
Thanks!
Jim
I am scifi
-
November 18th, 2003, 11:16 PM
#2
Have you considered doing it something like this?
Code:
this.button1.Click += new System.EventHandler(Button1Click);
//...
void Button1Click (object sender, EventArgs e)
{
ThreeFunctions ();
}
void ThreeFunctions ()
{
ResetButtonColors ();
XferPanelControls ();
button1SpecificProcesses ();
}
private void Form1_Load(object sender, System.EventArgs e)
{
ThreeFunctions ();
}
It seems to better express your intent.
I hope that helps!
-
November 18th, 2003, 11:18 PM
#3
But if you're really, really determined to do it your way, consider this:
http://www.syncfusion.com/FAQ/WinForms/FAQ_c92c.asp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|