How can I write the following code in practice - page 2

 
William Roeder:
  1. You've already been told that that is impossible and was given the only solution

  2. Here's a different solution, less efficient:

  3. Now answer my question #8.2

 want not to write 40 lines of code. As in other languages, the constant is used as a variable. After writing 40 lines, there is no problem. Thank you for your interest.

 
Mehmet Bastem:


I did not understand my question. variable with constant. how can we assign constants to a variable? and do it with the for loop. writing 40 lines is not the solution.

example,

for (int i = 0; i < 40; i++)

                            {

                                 ((string)this.Controls["MagicNumara" + (i + 1)]).Text;

Mehmet Bastem:


I did not understand my question. variable with constant. how can we assign constants to a variable? and do it with the for loop. writing 40 lines is not the solution.

example,

for (int i = 0; i < 40; i++)

                            {

                                 ((string)this.Controls["MagicNumara" + (i + 1)]).Text;

William Roeder:
  1. You've already been told that that is impossible and was given the only solution

  2. Here's a different solution, less efficient:

  3. Now answer my question #8.2

The user wants magic numbers to be entered this way. He wouldn't take my advice.  input MagicSeri="123123; 43443; 34343";


 
It's possible with some special #define and sort of iterative declaration list. So that in OnInit you have all numbers inside an array. The code is too ugly to post it.