Stan,
If you are deriving from a control (or other class) you can raise a base
event, by calling a special a special protected method. For example the
DataGrid.DoubleClick event is raised by the DataGrid.OnDoubleClick method.
This DoubleClick/OnDoubleClick relationship is a standard design pattern in
..NET that I would recommend you follow in your own classes. For details see:
http://msdn.microsoft.com/library/d.../cpgenref/html/cpconEventNamingGuidelines.asp
http://msdn.microsoft.com/library/d...s/cpgenref/html/cpconEventUsageGuidelines.asp
You would need something like:
Public Class DataGridEnter
Inherits DataGrid
Protected Overrides Function ProcessCmdKey( _
ByRef msg As System.Windows.Forms.Message, _
ByVal keyData As System.Windows.Forms.Keys) _
As Boolean
If msg.WParam.ToInt32() = CInt(Keys.Enter) Then
MyBase.OnDoubleClick(EventArgs.Empty)
Return True
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function 'ProcessCmdKey
End Class
Note in VB.NET your OnMyEvent method can simply call RaiseEvent MyEvent, as
RaiseEvent will check to see if there are any handlers...
Hope this helps
Jay