this is for VB6 or .net?

either way your code is flawed in that you want to dim the var as a control
VB Code:
  1. Dim ctrl as Control
  2. For Each ctrl in Me.Controls
  3.     if TypeOf ctrl Is Textbox then
  4.        'Do something
  5.     end if
  6. Next

this is the VB6 method.. sorry im not sure if it applies to .net