forum

home / developersection / forums / how to get all child controls of a windows forms form of a specific type (button/textbox)?

How to get ALL child controls of a Windows Forms form of a specific type (Button/Textbox)?

Anonymous User 2783 22-Jan-2014

I need to get all controls on a form that are of type x. I'm pretty sure I saw that code once in the past that used something like this:

dim ctrls() as Control

ctrls = Me.Controls(GetType(TextBox))

I know I can iterate over all controls getting children using a recursive function, but is there something easier or more straightforward, maybe like the following?

Dim Ctrls = From ctrl In Me.Controls Where ctrl.GetType Is Textbox


c# c# 
Updated on 23-Jan-2014

I am a content writter !

Can you answer this question?

Answer

1 Answers

Liked By