c# - Get class member by its name -


i need member of class within class.

in mainform (class design) have lot of combobox , textbox, write name 1 per 1 uncomfortable, think it's possible no sure.

for ilustrate, suppose have 10 combobox name 'cb_0..9' instead of write name of combobox want access selectedindex within loop:

for (int = 0; < 10; i++) {    this.getmember("cb_" + i).selectedindex = 1; } 

is possible , simple ?

yes. need cast control able use combobox, e.g.

((combobox)this.controls["cb_" + i]).selectedindex = 1; 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -