Using anonymous method with diff signature?

  • Thread starter Thread starter Brett Romero
  • Start date Start date
B

Brett Romero

I'd like to have a specific method execute on the click event of a
control. The common syntax is:

Control1.Click += new EventHandler( Control1_Click );

void Control1_Click( object sender, EventArgs e )
{
//....
}


Instead of Control1_Click executing, I'd like this method to execute:

GetId(eMouseEventArgs, i, Control3.Name.ToString())

The signature is:

public void GetId( MouseEventArgs e, int pColumnNumber, string
pControlName )

I need to pass in the above parameters. How can I execute this method
on the click event?

Thanks,
Brett
 
I should really start waiting a little longer before posting...so I can
avoid having to turn around and answer my own questions : )

Control1.Click += delegate(object psender, EventArgs pe)
{
GetId(eMouseEventArgs, i, Control3.Name.ToString())
};

Brett
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top