Home All Groups Group Topic Archive Search About

user control and events

Author
30 Jun 2005 9:21 AM
Sam
Hi,
I've got a user control with a method called Collapse. I would like
that when this method is called (it's only called inside the user
control, never by the client), an event can be caught.
So my client form can catch an event such as OnCollapse.
HOw can I do that ? Syntax ?

Thx

Author
30 Jun 2005 9:54 AM
Peter Proost
Hi in your usercontrol declare OnCollapse as a public event
Public Event yourEvent()

Then inside the method collapse call the event with raiseevent like this:
RaiseEvent OnCollapse

Now on your form your usercontrol has got an extra event, called OnCollapse
which you can catch

Hth Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

Show quoteHide quote
"Sam" <samuel.berthe***@voila.fr> schreef in bericht
news:1120123299.493726.31210@z14g2000cwz.googlegroups.com...
> Hi,
> I've got a user control with a method called Collapse. I would like
> that when this method is called (it's only called inside the user
> control, never by the client), an event can be caught.
> So my client form can catch an event such as OnCollapse.
> HOw can I do that ? Syntax ?
>
> Thx
>
Author
30 Jun 2005 10:16 AM
Sam
thx a lot ! it works :)
Author
30 Jun 2005 10:25 AM
Ken Tucker [MVP]
Hi,

        Add an event to the usercontrol that you raise in collapse
procedure.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmEvent.asp

Ken
---------------------
"Sam" <samuel.berthe***@voila.fr> wrote in message
news:1120123299.493726.31210@z14g2000cwz.googlegroups.com...
Hi,
I've got a user control with a method called Collapse. I would like
that when this method is called (it's only called inside the user
control, never by the client), an event can be caught.
So my client form can catch an event such as OnCollapse.
HOw can I do that ? Syntax ?

Thx