c# - Get variable by name dynamically - Without Reflection -
this question has answer here:
- string variable name 4 answers
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
Post a Comment