Dear all,
i have a situation in which i loop through the controls of a form.

i need to get the controls who is inherited from textbox or is a textbox itself

i have tried the following code

VB Code:
  1. for each ctl as control in frmx.controls
  2. if typeof ctl is textbox then
  3. 'do something
  4. end if
  5. next

this code works only for original textbox controls, but if i have controls that inherits from the textbox, it won't be collected

so i tried other code, like this

VB Code:
  1. for each ctl as control in frmx.controls
  2. if ctl.gettype.isassignablefrom(gettype(textbox)) then
  3. ' do something
  4. end if
  5. next

this give me only the inherited , not both !!!

i have also tried this code

VB Code:
  1. for each ctl as control in frmx.controls
  2.   If ctl.GetType.BaseType Is (GetType(textBox)) Then
  3.   'do anything
  4.   End If
  5. next

this code works for only the inherited controls, but the original textbox do not work.

how can i set a condition to gather all textboxes and all controls who inherits from textbox. i dont want to use and / or operators as the code already is very heavy and complicated and recursive. it is driving me crazy already


thx in advance