title: Passing type to a function in VB.NET
body: <p>I get a compile error Type "ctltype" is not defined with this code.</p>
  
  <p>This is .NET 1.1 legacy code so not good I know.</p>
  
  <p>Anyone know why??</p>
  
  <pre><code>Public Function GetControlText(ByVal ctls As Control, ByVal ctlname As String, ByVal ctltype As Type) As String
  
          Dim ctl As Control
          Dim res As String
  
  
          ctl = ctls.FindControl(ctlname)
          If ctl Is Nothing Then
              Return ""
          End If
  
          res = CType(ctl, ctltype).Text
  
          If res Is Nothing Then
              Return ""
          Else
              Return res
          End If
  
      End Function
  </code></pre>