I have a class MyDataGrid which is inherited from Datagrid
which have two protected override functions.
i want to register the events.
for example
public class MyDataGrid : DataGrid

{
protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
{
//dosomething
}
protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
{
//dosomething
}
Now i want to register these events
i m registering as
this.dataGrid1.MouseDown+=new System.Windows.Forms.MouseEventHandler(this.OnMouseDown);
this.dataGrid1.MouseMove+=new System.Windows.Forms.MouseEventHandler(this.OnMouseMove);
error is
Method 'System.Windows.Forms.Control.OnMouseDown(System.Windows.Forms.MouseEventArgs)' does not match delegate 'void System.Windows.Forms.MouseEventHandler(object, System.Windows.Forms.MouseEventArgs)'
Method 'System.Windows.Forms.Control.OnMouseMove(System.Windows.Forms.MouseEventArgs)' does not match delegate 'void System.Windows.Forms.MouseEventHandler(object, System.Windows.Forms.MouseEventArgs)'
can anybody tell me waht's the solution?
i m coding in C# Windows application ,version 1.1(2003)

change your code from

protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e) 
  {
    //dosomething
  }

to

protected override void OnMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
  {
     //dosomething
  }

simply your methods parameters don't match with the requested delegate's

ps: don't forget to put coding tags while posting code segments

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.