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:
for each ctl as control in frmx.controls if typeof ctl is textbox then 'do something end if 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:
for each ctl as control in frmx.controls if ctl.gettype.isassignablefrom(gettype(textbox)) then ' do something end if next
this give me only the inherited , not both !!!
i have also tried this code
VB Code:
for each ctl as control in frmx.controls If ctl.GetType.BaseType Is (GetType(textBox)) Then 'do anything End If 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




Reply With Quote