I am a vb6 programmer just moving over to vb.net.
I have an form onto which I have dynamically added a number of panels.
I have dynamically added a label and three RadioButtons to each of these
panels.
What I want to do is then scroll through each of the RadioButtons in each of
the Panels to determine whether it is Checked or not.
Im using the following code to scroll through the RadioButtons but am
getting the error
"An unhandled exception of type 'System.InvalidCastException' occurred in
StaffActions.exe
Additional information: Specified cast is not valid."
My code is
==================================================
For Each ctlPanel In Panel1.Controls
If ctlPanel.Name <> "pnlRate" Then
For Each ctlRate In ctlPanel.Controls 'ERROR ON THIS LINE
Debug.WriteLine(ctlPanel.Name & " - " &
ctlRate.GetType.ToString)
Next
End If
Next
==================================================
I'm a bit confused as I seem to be able to scroll through a collection of
Panels in my main panel (Panel1), but I can't then scroll through the
collection of RadioButtons in each of these panels.
Could someone explain the prob to me please
tia
Terry Holland