Im sorry, if I have a groupbox with following checkboxes: minim, null,
medium, medium high, high,extreme, and only 1 radiobutton has to be checked
, how should I do?
Thanks
SOLVED!
Public Class ExtPanel
Inherits GroupBox
Private _binding As String
Public Property Binding_control() As String
Get
Try
Return _binding
Catch
End Try
End Get
Set(ByVal value As String)
Try
_binding = value
Dim a As RadioButton = Me.Controls(_binding)
a.Checked = True
Debug.Print("->" & _binding)
Catch
For Each k In Me.Controls
If k.GetType.ToString.Contains("RadioButton") Then
Dim dx As RadioButton = CType(k, RadioButton)
dx.Checked = False
End If
Next
End Try
End Set
End Property
Public Sub initialize()
For Each d In Me.Controls
If d.GetType.ToString.Contains("RadioButton") Then
Dim dx As RadioButton = CType(d, RadioButton)
AddHandler dx.Click, AddressOf changed
End If
Next
End Sub
Private Sub changed(ByVal sender As Object, _
ByVal e As System.EventArgs)
'Me.Binding_control = sender
Me.Binding_control = sender.name
Me.Text = sender.name
End Sub
End Class
--------
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
For Each d In Me.Controls
Debug.Print(d.GetType.ToString())
If d.GetType.ToString().Contains("ExtPanel") Then
Dim dx As ExtPanel = CType(d, ExtPanel)
dx.initialize()
End If
Next
End Sub