Treatment of shape elements with large numbers



  • Let's say there are a number of elements on the form: label1label2 etc. The user introduces the field number he wants to change, and its meaning. How to turn to a certain number field without using switch?



  • The container (form, panel, etc.) containing marks (label) has a characteristic. https://msdn.microsoft.com/ru-ru/library/system.windows.forms.control.controls(v=vs.110).aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-1 returning a collection of subsidiary management elements. Make this set a type cycle. foreach And you can access every mark in turn.

    If you need a specific number mark, it'll be appropriate to create a mass (or even a dictionary) int- CategoryLabelfill it once with the marked marks and then access the index.

    There's another option: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection.find(v=vs.110).aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-1 on the list that returns the above properties Controls and use the name directly. label1label2 etc. Well, there are plenty of options.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2