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 User237022-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


Updated on 23-Jan-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By