From: Jacko on

Thanks Mike

I used the addhandler method and got it working

Regards
Jacko


"Family Tree Mike" <FamilyTreeMike(a)discussions.microsoft.com> wrote in
message news:6A247C90-B2FE-425A-8495-52E6754DE13C(a)microsoft.com...
>
>
> "Jacko" wrote:
>
>>
>> Forgot to mention, the project is in VB.NET
>>
>> "Jacko" <someone(a)somewhere.com> wrote in message
>> news:%23hAuFnBdKHA.5156(a)TK2MSFTNGP04.phx.gbl...
>> >
>> > Hi
>> >
>> > I have a UserControls with 20 buttons, how do i create a single
>> > delegate
>> > for all these buttons for the click event, which will show in the
>> > hosted
>> > windows form.
>> >
>> > Pointer to source will be helpful
>> >
>> > Regards
>> > Jacko
>> >
>> >
>>
>>
>> .
>>
>
> Create a subroutine to handle all the buttons:
>
> private sub ClickSub _
> (ByVal sender as System.Object, ByVal e as System.EventArgs)
> MessageBox.Show("Here...")
> end sub
>
>
>
> Then in the form constructor, you do the following for all buttons:
>
> AddHandler Button1.Click, AddressOf ClickSub
>
>
> I don't know what the fragment of your question "...which will show in the
> hosted windows form" means.
>
> Mike