click mouse event

  • Thread starter Thread starter juli
  • Start date Start date
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");
}
 
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.
 
Back
Top