G
Guest
I am trying to create a generic routine to create dynamically either Radio
buttons or CheckBoxes. The RadioButton has the event "CheckedChanged" which
doesn't exist in the CheckBox control.
I tried to create the controls through reflection, then check if it has this
property as follows to add a handler as follows
Dim rdoControl1 = GetControl(1)
Dim typelocal As Type = rdoControl1.GetType
Dim ev() As EventInfo = typelocal.GetEvents
Dim ev1 As EventInfo = typelocal.GetEvent("CheckedChanged")
If Not ev1 Is Nothing Then
AddHandler rdoControl1.CheckedChanged, AddressOf GenericClick
End If
Private Function GetControl(ByVal ControlType As Integer) As Control
Dim Configcontrol
If ControlType = 1 Then
Configcontrol = System.Activator.CreateInstance(GetType(RadioButton))
end IF
Return Configcontrol
End Function
When I try to compile and run I can not because I get an error indicating
that "CheckedChanged" is not an event of the system.object.
Thanks for your help
buttons or CheckBoxes. The RadioButton has the event "CheckedChanged" which
doesn't exist in the CheckBox control.
I tried to create the controls through reflection, then check if it has this
property as follows to add a handler as follows
Dim rdoControl1 = GetControl(1)
Dim typelocal As Type = rdoControl1.GetType
Dim ev() As EventInfo = typelocal.GetEvents
Dim ev1 As EventInfo = typelocal.GetEvent("CheckedChanged")
If Not ev1 Is Nothing Then
AddHandler rdoControl1.CheckedChanged, AddressOf GenericClick
End If
Private Function GetControl(ByVal ControlType As Integer) As Control
Dim Configcontrol
If ControlType = 1 Then
Configcontrol = System.Activator.CreateInstance(GetType(RadioButton))
end IF
Return Configcontrol
End Function
When I try to compile and run I can not because I get an error indicating
that "CheckedChanged" is not an event of the system.object.
Thanks for your help