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:
00921004
Views:
31
>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...

This works in my test web app but not in the live one. I will have to see what evil forces are imposing their open office propaganda on my happy family of products. :p

Thanks for the answer,
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform