Hi,
I have some Radio Controls in a Group Panel and I would like to somehow loop through them and find if one of them is checked.
Here is my code to loop through these radio controls:
It gives the following error:
I am thinking that one of the reasons it could be giving this error is beacuse there is also a Label in the group as well as the radio controls.
Can anybody help me with this error?
Cheers,
Bozzy
I have some Radio Controls in a Group Panel and I would like to somehow loop through them and find if one of them is checked.
Here is my code to loop through these radio controls:
VB.NET:
For Each control As CheckBox In groupGraphics.Controls
If control.Checked Then
If control.Text.Equals("Other") Then
_Graphics = textGraphicsOther.Text
Else
_Graphics = control.Text
End If
End If
Next
It gives the following error:
Unable to cast object of type 'System.Windows.Forms.Label' to type 'System.Windows.Forms.CheckBox'.
I am thinking that one of the reasons it could be giving this error is beacuse there is also a Label in the group as well as the radio controls.
Can anybody help me with this error?
Cheers,
Bozzy