 <p>After understanding that what you want is to get <strong>one</strong> number at each press of the button and that <strong>each time</strong> you want to calculate the Min and Max I suggest:</p> <pre><code>private List&lt;int&gt; _numbers = new List&lt;int&gt;(); // Use List&lt;int&gt; to avoid having irrelevant 0 items private int _min; private int _max; private void Add_Data_Btn_Click(object sender, EventArgs e) { //Parse and add new number to collection (notice - this does not take care of invalid input.. var number = int.Parse(i_richTextBox1.Text); // If it is the first time iterating then this number is both the _min and _max if(_numbers.Count == 0) { _min = number; _max = number; } else { //Check if need to update _min or _max if(number &lt; _min) _min = number; else if(number &gt; max) _max = number; } _numbers.Add(number); } </code></pre> <p><em>Of course you can still use linq <code>.Min</code> and <code>Max</code> operations on the collection to check for the updated values but why do an <code>o(2n)</code> when you can <code>2x o(n)</code></em></p> <hr> <p>Answer <strong>before</strong> understanding latest comment:</p> <blockquote> <p>To deal with the <code>0</code> problem:</p> </blockquote> <p>You can use Linq <code>Except</code> or check that the item isn't <code>0</code> when looking for Min and Max but I'd just suggest changing from an <code>int[10]</code> to a <code>List&lt;int&gt;</code> - That way you won't have those empty items.</p> <p>If it is a list then each time the button is pressed:</p> <pre><code>private void Add_Data_Btn_Click(object sender, EventArgs e) { numberList.Add(int.Parse(i_richTextBox1.Text)); } </code></pre> <blockquote> <p>Getting Min and Max:</p> </blockquote> <p>Use linq:</p> <pre><code>List&lt;int&gt; numbers = new List&lt;int&gt; {2, 5, 8, 7, 6 7}; var min = numbers.Min(); var max = numbers.Max(); </code></pre> <p>Or if you want to do it in <code>o(n)</code> instead of <code>o(2n)</code>:</p> <pre><code>List&lt;int&gt; numbers = new List&lt;int&gt; {2, 5, 8, 7, 6 7}; int min = numbers[0]; int max = numbers[0]; foreach(item in numbers) { if(item &gt; max) max = item; else if(item &lt; min) min = item; } </code></pre> <blockquote> <p>Change way of getting numbers:</p> </blockquote> <p>If you want to change the way you get the data from the <code>TextBox</code> and get it all at once (instead of one number at a time) then use <code>string.Split</code>:</p> <pre><code>string data = "2 5 8 7 6 7"; var numbers = data.Split(' ') .Select(int.Parse).ToList(); // Or if you might have more spaces: string data = "2 5 8 7 6 7"; var numbers = data.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse).ToList(); </code></pre> <hr>