Click here to Skip to main content
15,916,842 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: a coding problem Pin
Dave Kreskowiak3-Jan-08 10:58
mveDave Kreskowiak3-Jan-08 10:58 
GeneralRe: a coding problem Pin
Ray Cassick3-Jan-08 11:30
Ray Cassick3-Jan-08 11:30 
QuestionApplication exits without error message Pin
Volker Weichert3-Jan-08 9:06
Volker Weichert3-Jan-08 9:06 
GeneralRe: Application exits without error message Pin
Christian Graus3-Jan-08 11:12
protectorChristian Graus3-Jan-08 11:12 
GeneralRe: Application exits without error message Pin
Volker Weichert4-Jan-08 1:55
Volker Weichert4-Jan-08 1:55 
GeneralCannot cast from ControlCollection to ControlCollection Pin
Ed Hill _5_3-Jan-08 6:30
Ed Hill _5_3-Jan-08 6:30 
GeneralRe: Cannot cast from ControlCollection to ControlCollection Pin
Ed Hill _5_3-Jan-08 6:34
Ed Hill _5_3-Jan-08 6:34 
GeneralRe: Cannot cast from ControlCollection to ControlCollection Pin
Dave Kreskowiak3-Jan-08 7:16
mveDave Kreskowiak3-Jan-08 7:16 
I'd probably rewrite this so you don't have a "nextChildControl" section. One level should be enough.

Speaking of level, I'd also change this method to take as parameters a ControlCollection AND an interger representing depth, so you can have a collection in a collection in a collection, ... Probably something like this:
Public Function reportApplicationState(ByVal controlCollection As ControlCollection, Optional ByVal childDepth As Integer = 0) As String
    Dim layoutIndent As New String(" "c, childDepth)
    Dim report As String = String.Empty
    Dim childControl As Control
 
    For Each childControl In controlCollection
        If childControl.Controls.Count > 0 Then
            report &= childControl.Name & ":" & Environment.NewLine
            report &= reportApplicationState(childControl.Controls, childDepth + 1)
        Else
            report &= layoutIndent & childControl.Name & getValue(childControl) & Environment.NewLine
        End If
    Next
 
    Return report
End Function

This is by no means tested, but you should get the idea...



A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007




GeneralRe: Cannot cast from ControlCollection to ControlCollection Pin
Ed Hill _5_3-Jan-08 22:25
Ed Hill _5_3-Jan-08 22:25 
GeneralInvoice Management System Pin
wEb GuRu...3-Jan-08 1:26
wEb GuRu...3-Jan-08 1:26 
GeneralRe: Invoice Management System Pin
Dave Kreskowiak3-Jan-08 5:03
mveDave Kreskowiak3-Jan-08 5:03 
GeneralRe: Invoice Management System Pin
wEb GuRu...3-Jan-08 5:09
wEb GuRu...3-Jan-08 5:09 
GeneralInserting XML Elements using XMlDocument Pin
Benny_Lava3-Jan-08 0:18
Benny_Lava3-Jan-08 0:18 
GeneralRe: Inserting XML Elements using XMlDocument Pin
Dave Kreskowiak3-Jan-08 4:59
mveDave Kreskowiak3-Jan-08 4:59 
GeneralRe: Inserting XML Elements using XMlDocument Pin
Kschuler3-Jan-08 5:48
Kschuler3-Jan-08 5:48 
GeneralRe: Inserting XML Elements using XMlDocument Pin
Volker Weichert3-Jan-08 8:49
Volker Weichert3-Jan-08 8:49 
GeneralDatabase not updating after using insert on submit with linq. Pin
TechnoDev3-Jan-08 0:14
TechnoDev3-Jan-08 0:14 
GeneralRe: Database not updating after using insert on submit with linq. Pin
nishkarsh_k3-Jan-08 0:33
nishkarsh_k3-Jan-08 0:33 
GeneralSaving Webpage Contents into Excel Pin
viji]3-Jan-08 0:11
viji]3-Jan-08 0:11 
GeneralRe: Saving Webpage Contents into Excel Pin
Dave Kreskowiak3-Jan-08 4:44
mveDave Kreskowiak3-Jan-08 4:44 
GeneralTransparent back color property of label Pin
nishkarsh_k2-Jan-08 20:52
nishkarsh_k2-Jan-08 20:52 
GeneralRe: Transparent back color property of label Pin
Dave Kreskowiak3-Jan-08 1:58
mveDave Kreskowiak3-Jan-08 1:58 
Generalsec urity issue Pin
Tauseef A2-Jan-08 20:40
Tauseef A2-Jan-08 20:40 
GeneralRe: sec urity issue Pin
Dave Kreskowiak3-Jan-08 4:50
mveDave Kreskowiak3-Jan-08 4:50 
QuestionRe: sec urity issue Pin
Tauseef A3-Jan-08 16:17
Tauseef A3-Jan-08 16:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.