Developer technologies | VB
An object-oriented programming language developed by Microsoft that can be used in .NET.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hallo,
I am trying to make radio buttons binding, it is exactly similar to the thread below,
I have converted the C code to VB.net but i having following errors, could anyone fix this .
Public Class BBRadioButtonString
Inherits RadioButton
Protected oBinding As Binding = Nothing
Protected bs As BindingSource = New BindingSource()
Protected DataValue As String = ""
Public Overridable Sub DataBind(ByVal bindingSource As BindingSource, ByVal Column As String, ByVal Optional dataValue As String = "")
Me.Checked = False
Me.bs = bindingSource
Me.oBinding = New Binding("Checked", Me.bs, Column)
If dataValue <> "" Then
Me.DataValue = dataValue
Else
Me.DataValue = Me.Text
End If
Me.oBinding.Format = New ConvertEventHandler(AddressOf Me.FormatHandler)
oBinding.Parse += New ConvertEventHandler(AddressOf Me.ParseHandler)
Validated += New EventHandler(AddressOf Me.ValidatedHandler)
DataBindings.Add(Me.oBinding)
End Sub
Protected Overridable Sub FormatHandler(ByVal sender As Object, ByVal e As ConvertEventArgs)
If e.Value.ToString() = Me.DataValue Then
e.Value = True
Else
e.Value = False
End If
End Sub
Protected Overridable Sub ParseHandler(ByVal sender As Object, ByVal e As ConvertEventArgs)
If CBool(e.Value) = True Then e.Value = Me.DataValue
Me.bs.EndEdit()
End Sub
Private Sub ValidatedHandler(ByVal sender As Object, ByVal e As EventArgs)
Me.bs.EndEdit()
End Sub
End Class
It says i have to use Raise event
Tahnks
An object-oriented programming language developed by Microsoft that can be used in .NET.
Answer accepted by question author
The syntax is different:
AddHandler oBinding.Format, AddressOf Me.FormatHandler
AddHandler oBinding.Parse, AddressOf Me.ParseHandler
AddHandler Validated, AddressOf Me.ValidatedHandler