Recursion solves the problem with printing controls that contain other
controls (such as Form, Panel or GroupBox). Because all controls--including
Forms--derive from Control, which has a Controls collection, it's simple.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
showControlTypeName(Me, 0)
End Sub
Private Sub showControlTypeName(ByVal ctl As Control, ByVal indent As
Integer)
Debug.WriteLine(Space(indent * 3) & ctl.Name & ", " &
ctl.GetType().Name)
For Each child As Control In ctl.Controls
showControlTypeName(child, indent + 1)
Next
End Sub
"Tor Inge Rislaa" <no*************@rislaa.no> wrote in message
news:_P****************@news4.e.nsc.no...
Finding name and type
In the activate procedure of a form I want to write to the debug window,
name and type of all controls at that actual form. Is there a smart way to
do that?
Allso for the entire application I want to print the name of all forms to
the debug window.
TIRislaa