wild_bill
Apr 26th, 2005, 12:26 PM
I'm new to ASP.NET. I've been asked to convert one of my windows apps into an asp page. I would like to loop through the controls on my page, so I thought using a similar syntax would work, but it doesnt. Here is an example of the code I'm trying to use:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each oControl As Control In Page.Controls
If TypeOf oControl Is TextBox Then
Dim txtbox As TextBox = CType(oControl, TextBox)
txtbox.Text = Date.Now.ToString
End If
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each oControl As Control In Page.Controls
If TypeOf oControl Is TextBox Then
Dim txtbox As TextBox = CType(oControl, TextBox)
txtbox.Text = Date.Now.ToString
End If
Next
End Sub