Hello, i've recently read about article of Sam. He uses withevents, event and raiseevent in his project. Can anyone explain for me about them? thank you.
Printable View
Hello, i've recently read about article of Sam. He uses withevents, event and raiseevent in his project. Can anyone explain for me about them? thank you.
Strange, I don't remember righting any articles.
anyway, if you want to use events in your usercontrols, forms and class modules then you can.
first you have to declare your events, in the classmodule or usercontrol, say you have an event Hello, with a parameter x a an integer. (Don't ask me why.)
Declare it with
then at anypoint in the usercontrol code you want to fire event just goCode:
Event Hello(x as integer)
it doesn't have to be 3 obviously it can be any integer you want.Code:
RaiseEvent Hello(3)
if you have your events in a class module you have to declare your class with
instead ofCode:
Dim Withevents objWhatever as new Class1
class modules are a bit funny with events there all right when they're contained in other class modules but they're a bit funny when thay're contaned in forms.Code:
Dim objWhatever as new Class1
Hope this helps.
heh, actually it's sam huggill who wrote the article, but thanks a lot for the info.