title: vb.net cycle through controls not working
body: <p>I'm trying to cycle through the controls on a page that consists of textboxes and a dropdown and clear them.  </p>
  
  <p>When I debug, parent is the current page, value is equal to ASP.nameOfCurrentpage_aspx and 
  Type is equal to system.web.ui.page, but c has the value of ASP.site_master and type of system.web.ui.control.  I also put in x to see how many controls it finds and x comes back as 1 even though there are 15 or so textboxes on the page.  Is there a way I can force c to have the value of ASP.nameOfCurrentpage_aspx?  Or is that not my problem?  Any help is appreciated.</p>
  
  <pre><code>Protected Sub btnClear_Click(sender as Object, e as System.eventargs) Handles btnClear.Click
     ClearForm(Page)
  
  End Sub
  
  Public Sub ClearForm(ByRef Parent As Control)
      Dim c As Control
      Dim x As Integer = Parent.Controls.Count
      For Each c In Parent.Controls
          If c.GetType.ToString = "System.Web.UI.HtmlControls.HtmlForm" Then
              ClearForm(c)
          ElseIf c.GetType() Is GetType(TextBox) Then
              'is it a Text Box?
              Dim t As TextBox = c
              t.Text = ""
          ElseIf c.GetType() Is GetType(DropDownList) Then
              'is it a dropdown list?
              Dim d As DropDownList = c
              d.ClearSelection()
          End If
      Next
  
  End Sub
  </code></pre>