尝试将事件处理程序添加到在用户输入上创建的单选按钮,以this和this作为示例。
但是,我收到一个answerOptions
不是事件的错误。
创建单选按钮
Private answerOptions(n) As RadioButton
...
Private Sub showQuestion(n As Integer)
For i = 0 To answerOptions.Length - 1
answerOptions(i) = New RadioButton
AddHandler answerOptions, AddressOf Me.Radios_Click
With answerOptions(i)
' --------- SET TEXT, LOCATION ETC.
End With
Me.Controls.Add(answerOptions(i))
Next
End Sub
计划然后处理事件
Private Sub Radios_Click(sender As Object, e As EventArgs) Handles answerOptions.checked
End Sub
我希望在检查无线电时发生一些事情。不想使用复选框,因为我想一次限制一个选择。