Group: Members
Posts: 82
Member No.: 75
Joined: 4-December 04
Just a technique critique <- I'm a poet!.
If you ever really need to call the event, then it might be best to place the code in a Sub or Function that the event calls; that way if you need to reuse the function or sub some where else it is available.
EXAMPLE:
CODE
Public Class BLAH
Public Sub Dosomething(Sender as object, e as System.EventArgs) . . . End Sub
Public sub Object_Click(Sender as Object, e as System.EventArgs) Handles Object.Click
Call Dosomething(Sender,e) End Sub
Public Sub Object2_Click(Sender as Object, e as System.EventArgs) Handles Object2.Click Call Dosomething(Sender,e) '----- Do Something else ------ End Sub
End Class
Now some cases you want the event "Tied" or to cascade to other users across a platform (Usually Client/Server development) at this point you probably want to not use the event and do an AddHandler routine to tie the event to a Sub or Function; so that it can cascade the information..
Just an FYI; throwing a wrench in the conversation..
Group: Members
Posts: 82
Member No.: 75
Joined: 4-December 04
In VB6 all objects are COM based, err most objects are COM based so, they generate the event signature
generally in a form of <object>_Keydown
to invoke the event is the same as invoking a sub routine call just simply place a call statement before the event (or leave blank isn't required, I do it to code for good form)
Call <object>_Keydown(args)
In VB.NET the contrast is that the events are object based; and that really is a debate in terminolgy. To invoke it you call the signature call using the "." seperator; which then looks as a property / method list