B
Brett
What are reasons to create your own events? Why not just call a class
method/function instead?
Thanks,
Brett
method/function instead?
Thanks,
Brett
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
rawCoder said:The way I use them ususally.
Events are for intimation.
An Object intimating a class for some event.
You cant by regular means call a method of the class that has instantiated
the object from within the object.
JohnFol said:Because a method or function has to be explicitly called. An even occurs
when something within the application happens by itself, or as a result of
something, like an error condition, or a timer event being fired. .
Also, consider a piece of code (A) that controls another piece of code(B).
How would B notify A that something has happened. It has no concept of
what has created it, and therefore cannot instigate the communication.
Generally, events are used to communicate an action, or-----Original Message-----
What are reasons to create your own events? Why not just call a class
method/function instead?
Thanks,
Brett
.
Brett said:What are reasons to create your own events? Why not just call a class
method/function instead?
Peter Proost said:Hi, I use them in usercontrols for example I've got a usercontrol with a
combobox on it and some more controls.
The combobox is filled with customers, and when I choose one the other
controls on the usercontrol get filled but I also want to notify the form
where my usercontrol is on. So in my usercontrol I code:
Public Event Customer(ByVal CustomerName as String)
and then when the comboxs' selectedindex changes I call my event like this
RaiseEvent Customer("MyCustomerName")
Brett said:What are reasons to create your own events? Why not just call a class
method/function instead?
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.