Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
For ... each control?
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00920575
Message ID:
00920589
Views:
31
This message has been marked as the solution to the initial question of the thread.
Joe,

You first have to find the form object, then loop the controls of the form. Below is an example sub of how that can be done:
    Private Sub LoopTextBoxes()

        ' Variables
        Dim nCnt%
        Dim oType As System.Type
        Dim frmTrgt As System.Web.UI.HtmlControls.HtmlForm
        Dim txtObj As System.Web.UI.WebControls.TextBox

        ' Loop Controls - Get Form
        For nCnt = 0 To Controls.Count - 1

            ' Assign Type
            oType = Controls(nCnt).GetType

            ' Determine Match
            If InStr(UCase(oType.FullName), "HTMLFORM", CompareMethod.Text) Then

                ' Assign Value
                frmTrgt = Controls(nCnt)

                ' Bail
                Exit For

            End If

            ' Free Memory
            oType = Nothing

        Next

        ' Loop Controls - Get Form
        For nCnt = 0 To frmTrgt.Controls.Count - 1

            ' Assign Type
            oType = frmTrgt.Controls(nCnt).GetType

            ' Determine Match
            If InStr(UCase(oType.FullName), "TEXT", CompareMethod.Text) Then

                ' Assign Control
                txtObj = frmTrgt.Controls(nCnt)

                ' Assign Value
                txtObj.Text = "Got It"

                ' Free Mem
                txtObj = Nothing

            End If

            ' Free Memory
            oType = Nothing

        Next

    End Sub
Happy 4th! Hope that helps...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform