Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
For ... each control?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00920575
Message ID:
00921004
Vues:
30
>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

Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform