AddHandler Syntax 
Author Message
 AddHandler Syntax

I have a usercontrol (container type) that needs to respond to events raised
by controls placed on it. Unfortunately, I cannot use WithEvents because the
controls are being added dynamically. I think AddHandler will work, but I
cannot find the documentation. Any help would be appreciated.

Protected Overrides Sub OnControlAdded(ByVal e As
System.WinForms.ControlEventArgs)
    Dim NewRadioButton As RadioButton
    If TypeOf (e.Control) Is Radiobutton Then
        NewRadioButton = CType(e.Control, RadioButton)
        AddHandler ???, ???
    End If
End Sub

Private Sub SmartGroupBox_RadioClicked(ByVal sender As Object, ByVal e As
System.EventArgs)
    'Code to respond to a Radio Button's Click Event
End Sub

--
Jonathan Allen



Thu, 29 May 2003 16:17:54 GMT  
 AddHandler Syntax
try:

 AddHandler NewRadioButton.Click, AddressOf Me.SmartGroupBox_RadioClicked


Quote:
> I have a usercontrol (container type) that needs to respond to events
raised
> by controls placed on it. Unfortunately, I cannot use WithEvents because
the
> controls are being added dynamically. I think AddHandler will work, but I
> cannot find the documentation. Any help would be appreciated.

> Protected Overrides Sub OnControlAdded(ByVal e As
> System.WinForms.ControlEventArgs)
>     Dim NewRadioButton As RadioButton
>     If TypeOf (e.Control) Is Radiobutton Then
>         NewRadioButton = CType(e.Control, RadioButton)
>         AddHandler ???, ???
>     End If
> End Sub

> Private Sub SmartGroupBox_RadioClicked(ByVal sender As Object, ByVal e As
> System.EventArgs)
>     'Code to respond to a Radio Button's Click Event
> End Sub

> --
> Jonathan Allen



Thu, 29 May 2003 19:28:10 GMT  
 AddHandler Syntax
Thanks, I owe you one.

--
Jonathan Allen


Quote:
> try:

>  AddHandler NewRadioButton.Click, AddressOf Me.SmartGroupBox_RadioClicked



> > I have a usercontrol (container type) that needs to respond to events
> raised
> > by controls placed on it. Unfortunately, I cannot use WithEvents because
> the
> > controls are being added dynamically. I think AddHandler will work, but
I
> > cannot find the documentation. Any help would be appreciated.

> > Protected Overrides Sub OnControlAdded(ByVal e As
> > System.WinForms.ControlEventArgs)
> >     Dim NewRadioButton As RadioButton
> >     If TypeOf (e.Control) Is Radiobutton Then
> >         NewRadioButton = CType(e.Control, RadioButton)
> >         AddHandler ???, ???
> >     End If
> > End Sub

> > Private Sub SmartGroupBox_RadioClicked(ByVal sender As Object, ByVal e
As
> > System.EventArgs)
> >     'Code to respond to a Radio Button's Click Event
> > End Sub

> > --
> > Jonathan Allen



Fri, 30 May 2003 04:01:52 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. AddHandler doesn't seem to work

2. AddHandler -or- WithEvents ???

3. AddHandler doesn't seem to work

4. AddHandler with Delegate

5. Intellisense and AddHandler

6. AddHandler on indexed array of controls

7. AddHandler -- Event Associations within an Instance Class.

8. Is it possible to detect AddHandler?

9. !! AddHandler / AddressOf !!

10. AddHandler, RemoveHandler, HasHandler??

11. AddHandler textbox.TextChanged??

12. AddHandler txtCustomer.textchanged question

 

 
Powered by phpBB® Forum Software