Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Every control that derives from Control has a Text property, which is every control — however for some controls this property does not have a meaning.</p> <p>To build the complete list of controls you need to iterate the Form's Controls collection and then, for each control within it, recursively iterate that control's Controls collection.</p> <pre><code>IList&lt;Control&gt; controlsOnForm = new List&lt;Control&gt;(); BuildControlsList(this.Controls, controlsOnForm); private static void BuildControlsList(ControlCollection controls, IList&lt;Control&gt; listToPopulate) { foreach (Control childControl in controls) { listToPopulate.Add(childControl); BuildControlsList(childControl.Controls, listToPopulate); } } </code></pre> <p>I'm not actually sure how you are going to differentiate between controls that have a useful Text property and those for which it is not used. Obviously one approach would be to exclude those controls that have an empty string for the Text property.</p> <p>One can also do something similar for the menu (note that you will need to modify this somewhat if you are using the MainMenuStrip):</p> <pre><code>IList&lt;Menu&gt; menusOnForm = new List&lt;Menu&gt;(); if (this.Menu != null) { menusOnForm.Add(this.Menu); BuildMenuList(this.Menu.MenuItems, menusOnForm); } private static void BuildMenusList(MenuItemCollection menuItems, IList&lt;Menu&gt; listToPopulate) { foreach (Menu menuItem in menuItems) { listToPopulate.Add(menuItem); BuildMenusList(menuItem.MenuItems, listToPopulate); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload