Control.ControlCollection.Find(String, Boolean) 方法

定义

根据控件的 Name 属性搜索控件并生成由所有匹配项组成的数组。Searches for controls by their Name property and builds an array of all the controls that match.

public:
 cli::array <System::Windows::Forms::Control ^> ^ Find(System::String ^ key, bool searchAllChildren);
public System.Windows.Forms.Control[] Find (string key, bool searchAllChildren);
member this.Find : string * bool -> System.Windows.Forms.Control[]
Public Function Find (key As String, searchAllChildren As Boolean) As Control()

参数

key
String

要在 Control.ControlCollection 中定位的键。The key to locate in the Control.ControlCollection.

searchAllChildren
Boolean

如果搜索所有子控件,则为 true;否则为 falsetrue to search all child controls; otherwise, false.

返回

包含匹配控件的 Control 类型数组。An array of type Control containing the matching controls.

异常

keynull 或为空字符串 ("")。key is null or the empty string ("").

适用于