>Bonjour!
>
>I woould like create a function to save all the fields(control) on my web page to a text file or database. In VB6 we could say something like for each control etc..
>if type textbox then....
>Can we do the same with VB.NET??
>
>Thanks Joel :)
Yes you can. From VS help "How to: Locate the Web Forms Controls on a Page by Walking the Controls Collection" topic:
"...A more practical application of walking the controls this way would be to create a recursive method that can be called to walk the Controls collection of each control as it is encountered. However, for clarity, the example below is not created as a recursive function. "
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim allTextBoxValues As String = ""
Dim c As Control
Dim childc As Control
For Each c In Page.Controls
For Each childc In c.Controls
If TypeOf childc Is TextBox Then
allTextBoxValues &= CType(childc, TextBox).Text & ","
End If
Next
Next
If allTextBoxValues <> "" Then
Label1.Text = allTextBoxValues
End If
End Sub
Cetin