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:

VB Code:
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         For Each oControl As Control In Page.Controls
  3.             If TypeOf oControl Is TextBox Then
  4.                 Dim txtbox As TextBox = CType(oControl, TextBox)
  5.                 txtbox.Text = Date.Now.ToString
  6.             End If
  7.         Next
  8.     End Sub