click mouse event

J

juli

Hello!
I am trying to write a function which will react on Mouse Event and I
keep getting errors.
error CS0029: Cannot implicitly convert type
'WindowsApplication2.MouseEventHandler' to
'System.Windows.Forms.MouseEventHandler'
this is the code I added:

public delegate void MouseEventHandler(object sender,
System.Windows.Forms.MouseEventArgs e);
this.line3.Click+=new
System.Windows.Forms.MouseEventHandler(line3_Click);
private void line3_Click(object
sender,System.Windows.Forms.MouseEventArgs e)
{
System.Console.WriteLine("gr8");
}
 
N

Nicholas Paldino [.NET/C# MVP]

juli,

You shouldn't be defining your own mouse event handler (especially if it
has the same signature). I would remove the delegate delcaration, and it
should probably work.

Granted, you have the fully qualified type names here, but I imagine
that's not cut and pasted from code (otherwise, you wouldn't get that
error).

Hope this helps.
 

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

Top