Hi,
I'm trying to loop through some checkboxes and save the values to a
row in the database (as below)

Dim objChk As Object
Dim Checked As Boolean = False
       For Each objChk In GroupBox2.Controls
                  If TypeOf objChk Is CheckBox AndAlso DirectCast
(objChk, CheckBox).Checked Then
                        objCurrentRow1.Item("Present") = objChk
                    End If
        Next

I've ran the project with breakpoints around this mark and it appears
to loop through 3/4 times and then I get the following error:

"Unable to cast object of type 'System.Windows.Forms.CheckBox' to type
'System.IConvertible'.Couldn't store <System.Windows.Forms.CheckBox,
CheckState: 1> in Present Column.  Expected type is Boolean."

Can you identify any simple thing wrong with the above code that would
rectify this error??

Reply via email to