c# - Get variable by name dynamically - Without Reflection -


this question has answer here:

i doing 1 one: tidy them

             //created on form1     textboxs[0] = textbox0;   textboxs[1] = textbox1;  textboxs[2] = textbox2;   textboxs[3] = textbox3; 

is there way convert below somehow?

for (int = 0; < ksy; i++)  //kisi sayısı {     // getting code (not variable)     textboxs[i] = textbox+i ; } 

update: wanted : find control name windows forms controls

everyone talks reflection . coudnt make reflection work

assuming cb_kisin fields can do:

for(int =  0; < ksy; i++) {     var field = this.gettype().getfield("textbox" + i);     var code = field.getvalue(this) code;     textboxs[i] = code; } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -