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
Post a Comment