Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclassing All Base Controls
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00642367
Message ID:
00644615
Views:
19
Hi David ,

Thanks for your help. I also found another way of doing this..

All you have to do is add make the event public

public event EventHandler Click

then in the OnClick Event i use this code.

It Checks the derived button to see if it has a click event defined. If it has it runs that click event if not it jusrt runs its own event.


if (Click!=null)
{
Click(this,e);
}
MessageBox.Show("base click");



My Base Button Class

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace CyberlogicBaseButton
{
///
/// Summary description for Class1.
///

public class CyberlogicBaseButton : System.Windows.Forms.Button
{
public event EventHandler Click;
public CyberlogicBaseButton()
{
//
// TODO: Add constructor logic here
//
}
protected override void OnClick(System.EventArgs e)
{

if (Click!=null)
{
Click(this,e);
}
MessageBox.Show("base click");
}


}
}
Fred Besterwitch, MCP

The harder you work. The luckier you get.
Previous
Reply
Map
View

Click here to load this message in the networking platform