Create custom Event in form object

S

sennopati

Dear all

How to create custom event in form object?? I want to use it in
inheritance form for add, edit, delete data

FYI. I Using visual studio 2005 .net framework 2

thx
 
P

Phill W.

sennopati said:
How to create custom event in form object?? I want to use it in
inheritance form for add, edit, delete data

For each event that you want "publish" from your base Form, you'll need
this little lot:

' The event itself (obviously)
Public Event AddingData( sender as Object, e as AddingEventArgs )

' A protected routine so that sub-classes can ask for the
' event to be raised
Protected Overridable Sub OnAddingData( e as AddingEventArgs )
RaiseEvent AddingData( Me, e )
End Sub

' [Probably] An Event arguments class that will contain properties
' that tell event /handlers/ more about this particular event.
' I would recommend creating these /even if/ you don't add any
' properties of your own to start with. If you don't and, later
' on, you discover that you /do/ need something specific, you'll
' have to recompile all your client code to change the Type!
Public Class AddingEventArgs
Inherits EventArgs

Private Sub New()
End Sub

Friend Sub New( ... arguments ... )
End Sub

Public Property ...
. . .
End Class

HTH,
Phill W.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top