Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 7th, 2007, 01:56 AM
Authorized User
 
Join Date: Jan 2007
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Event handling in c#


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.OnMous eDown);
this.dataGrid1.MouseMove+=new System.Windows.Forms.MouseEventHandler(this.OnMous eMove);

error is
 Method 'System.Windows.Forms.Control.OnMouseDown(System.W indows.Forms.MouseEventArgs)' does not match delegate 'void System.Windows.Forms.MouseEventHandler(object, System.Windows.Forms.MouseEventArgs)'
 Method 'System.Windows.Forms.Control.OnMouseMove(System.W indows.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)

Reply With Quote
  #2 (permalink)  
Old March 7th, 2007, 12:19 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

This problem would be better in a different forum catagory like C#.
I beleive the error is telling you exactly what the problem is at any rate.
Your methods do not match the delegate you are subscribing to.
Change you method signature to match the delegate.
That is your method must have two paramters, the object and the event args.
protected override void OnMouseMove(object sender, System.Windows.Forms.MouseEventArgs e) {//do something}



======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Handling Apocolypse2005 Visual Basic 2005 Basics 1 March 10th, 2009 07:14 AM
Event Handling C# 2.0 AccessAasif@aol.com C# 2005 2 January 25th, 2008 11:37 AM
Event handling in c# bhavna General .NET 1 March 7th, 2007 05:32 AM
Event Handling Bill Crawley ASP.NET 2.0 Basics 0 February 28th, 2007 07:32 AM
Help with Event handling nulogix Java GUI 1 October 11th, 2004 03:55 PM



All times are GMT -4. The time now is 06:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.