Home >Backend Development >C++ >How Can I Find and Modify a Specific Control by Name in Windows Forms?
Finding a specific control in the Windows window application is critical to modify its appearance or retrieve its data. To this end, the .Net provided
Control.ControlCollection.find method.
true . The following is an example of usage:
This code fragment searches the sub -control named "Textbox1" in the current window
Controls<code class="language-c#">TextBox tbx = this.Controls.Find("textBox1", true).FirstOrDefault() as TextBox; tbx.Text = "找到了!";</code>. If it is found, it converts the returned control to
Textbox object and set its Text property. For your specific problems, you can modify it as follows:
The above is the detailed content of How Can I Find and Modify a Specific Control by Name in Windows Forms?. For more information, please follow other related articles on the PHP Chinese website!