Public Sub go2()
Dim q As New Queue
Dim frm As Control = Me.FindControl("Form1")
Dim ctl As Control
Dim tb As TextBox
Dim ch As CheckBoxList
Dim rb As RadioButtonList
q.Enqueue(frm)
Dim i As Integer = 0
While q.Count > 0
Dim ctrls As Control = DirectCast(q.Dequeue(), Control)
For Each ctl In ctrls.Controls
If TypeOf ctl Is Panel Then
q.Enqueue(ctl)
ElseIf TypeOf ctl Is TextBox Then
i += 1
tb = DirectCast(ctl, TextBox)
tb.Text = tb.ID '& " " & vbCrLf '& "<br>"
'ElseIf TypeOf ctl Is CheckBoxList Then
' ch = DirectCast(ctl, CheckBoxList)
' i += 1
' 'TextBox1.Text &= ch.ID & " " & vbCrLf '& "<br>"
'ElseIf TypeOf ctl Is RadioButtonList Then
' rb = DirectCast(ctl, RadioButtonList)
' i += 1
' TextBox1.Text &= rb.ID & " " & vbCrLf '& "<br>"
End If
Next
End While
End Sub