radiobutton binding

  • Thread starter Thread starter Alcibiade
  • Start date Start date
A

Alcibiade

Hi to all, inside a groupbox I have 7 checkbox. I'm using databinding with
dataset, so how could I use databinding with radiobutton?
Thanks
 
Hi,

You can do that but radiobuttons have then to be set in pairs in groupboxes
(or other panels)
You have to bind "one" of them to the checked property, the other one goes
then automatically

Cor
 
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
 
Alcibiade,

That is not binding, that is setting.

Binding is automatically setting something to a value in the database which
is mostly in the case of a radionbutton one boolean value (on off).

You are using in my idea the radiobutton in a complete different way, so
please be next time more accurate in creating your questions.

Thanks in advance

Cor
 
Back
Top