For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
MsgBox(subCtrl.Text)
End If
If subCtrl.GetType Is GetType(System.Windows.Forms.ComboBox) Then
If subCtrl.GetType Is GetType(System.Windows.Forms.RadioButton) Then
If CType(subCtrl.Controls("rbttnM"), RadioButton).Checked Then
MsgBox("Male")
End If
If CType(subCtrl.Controls("rbttnF"), RadioButton).Checked Then
MsgBox("Female")
End If
End If
End If
Next
End If
Next
Enrique_2
0
Newbie Poster
Recommended Answers
Jump to PostSet the code in this other way and see if it still throws an exception:
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls If ctrl.GetType Is GetType(Windows.Forms.Panel) Then Select Case ctrl.GetType Case GetType(TextBox) ' do whatever ' Case GetType(ComboBox) Case GetType(RadioButton) Dim r As RadioButton = CType(ctrl, …
All 4 Replies
Enrique_2
0
Newbie Poster
Enrique_2
0
Newbie Poster
xrjf
213
Posting Whiz
Premium Member
Joris Claassen
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.