Users Pricing

forum

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

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

Anonymous User 3163 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


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md