Event and Functions
-
Is it write to say that an event is private sub Form_Load(byval sender as system.Object,byval e as System.Eventargs)handes MyBase.Load End sub and functions is private function abc()as string end function
-
Is it write to say that an event is private sub Form_Load(byval sender as system.Object,byval e as System.Eventargs)handes MyBase.Load End sub and functions is private function abc()as string end function
Nilish wrote:
handes MyBase.Load
This bit means that this function will be called in response to an event.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Is it write to say that an event is private sub Form_Load(byval sender as system.Object,byval e as System.Eventargs)handes MyBase.Load End sub and functions is private function abc()as string end function
private sub Form_Load(byval sender as system.Object,byval e as System.Eventargs)handes MyBase.Load End sub
This Form_Load is a event handler for Load event. That means when the page load event fires this handler will be invoked. Then, then function
private function abc()as string end function
This is need to call as abc() for executing.
Gg
-
Is it write to say that an event is private sub Form_Load(byval sender as system.Object,byval e as System.Eventargs)handes MyBase.Load End sub and functions is private function abc()as string end function
Private sub Form_Load... isn't an event. It's a procedure that handles an event. Any procedure can handle an event as long as it matches the signature of the event. A function returns a value while a procedure does not. This is how you could define an event.
Public Event SomeEvent(ByVal sender As Object, ByVal e As System.EventArgs)
The signature would be the parameters in the definition. I could also create an event like this.
Public Event AnotherEvent(ByVal someText As String)
In this case the procedure to handle this event would need to accept a string. Any procedure that does so can handle this event. It's good practice to create events that with the .net signature of (sender, e) where sender is an object and 'e' inherits from system.eventargs.