c# - Data in Array from N Textboes using For loop -


there "n" number of textboxes on form,

i want values in textboxes in array.

using "for" loop,

can me out this.

you can controls on form calling this.controls , loop through comparing control textbox, when textbox add value array mentioning.

i'd use this:

list<string> values = new list<string>(); foreach(control c in this.controls) {     if(c textbox)     {         /*i didnt need cast in intellisense, in case!*/         textbox tb = (textbox)c;         values.add(tb.text);     }  }  string[] array = values.toarray(); 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -