1

Each time a user clicks on a button, the inputted value in the text box will be read into an array, the box will be cleared, and the user can keep inputting values into that text box.

How do I program it so that an array of unknown size will be filled with all the values entered one at a time into the one text box?

Thanks!

elastic-g
  • 39
  • 7
  • 3
    You have to use a List instead – Transcendent Feb 14 '15 at 19:16
  • 1
    adding to @Transcendent's comment, recommend you use a List instead, because you can continue adding to it without caring about how large it is. see here: http://stackoverflow.com/questions/434761/array-versus-listt-when-to-use-which for more info on the very specific case when you actually need an array – DrewJordan Feb 14 '15 at 19:21

1 Answers1

3

Create a list like this one:

List<string> values = new List<string>();

And each time you want to add something use:

values.Add(textBox1.Text);
Norman
  • 3,279
  • 3
  • 25
  • 42