Current location - Quotes Website - Signature design - Winform of c#, how to get control properties according to the control name!
Winform of c#, how to get control properties according to the control name!
1. Use the public control [] find (string key, bool searchallchildren) method attached to C# form.

2. Write your own foreach? Loop method foreach (control control in this). Control).

3. Find the child who controls this. Controlled by the immediate parent control [key]; If it is a nested child control, you need to write a recursive method to get it.

4. Finally, run and choose the search method according to your actual needs.

Precautions:

C# enables C++ programmers to develop programs efficiently and call native functions written by C/C++ without losing the original powerful functions of C/C++. Because of this inheritance relationship, C# and C/C++ have great similarities, and developers familiar with similar languages can quickly turn to C#.