Hi Jonathon,
the function that handles an event can have any name, the main thing is
that the method that handles an event needs to have the correct signature for
the event. In the C# world setting up an event handler is something like:
object.TheEvent += new TheEventHandler(FunctionToHandleEvent);
where TheEvent is the event you want to handle, TheEventHandler is the
delegate used to point to the method that handles the event and
FunctionToHandleEvent is the name of the method that you have defined
somewhere which gets called when the event is raised.
The default code generated by Visual Studio when handling a button click is:
this.button1.Click += new System.EventHandler(this.button1_Click);
private void button1_Click(object sender, EventArgs e)
{
}
but it could just as well be:
this.button1.Click += new System.EventHandler(this.DoSomething);
private void DoSomething(object sender, EventArgs e)
{
}
Hope that helps
Mark Dawson
http://www.markdawson.org
"Jonathon" wrote:
In order to make a function handle an even such as a click, do you just
have to name the function [object_name]_EVENT where EVENT is the event
that you are trying to handle with the function?
I'm creating a compact framework app, and originally started in VB, but
ended up with C#. In the VB world I think you can explicitly define it
like:
function X() handles item.click
or something like that. Thanks in advance for the help.