Hello,
In your Save Button Click
For Each chkBox In GroupBox1.Controls.OfType(Of CheckBox)()
if Ctype(GroupBox1.controls("CheckBox" & i), checkbox).checked = true then
' your Code Here
end if
If you need to create Event for your Check Box then your code might be
Dim CheckBoxes As List(Of CheckBox) = New List(Of CheckBox)
Dim i As Integer = 1
Dim x As Integer = 10
Dim y As Integer = 15
For Each row As DataRow In objdtr.Rows
Dim chk As New CheckBox
chk.Name = row("Voltage")
chk.Text = row("Voltage")
chk.Location = New Point(x, y)
chk.Width = 70
GroupBox1.Controls.Add(chk)
x = x + 70
AddHandler chk.CheckedChanged, AddressOf ChkBox_CheckedChanged
Next
Private Sub ChkBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim chkBox As CheckBox = TryCast(sender, CheckBox)
If chkBox IsNot Nothing Then
MessageBox.Show(chkBox.CheckState)
End If
End Sub
'In Save Button Click
For Each chkBox In GroupBox1.Controls.OfType(Of CheckBox)()
if Ctype(GroupBox1.controls("CheckBox" & i), checkbox).checked = true then
' your Code Here
end if
Next
SAMIR
Sr. Software Engineer
Srisoft, if this helps please login to Mark As Answer. | Alert Moderator