 <p>The issue is the static variable <code>item</code> is initialized to 0 when the class loads. Once you change it by reading in the user inputted value, you don't allocate properly sized arrays for your static variables. You can fix this by doing so after reading in the value:</p> <pre><code>public static void addItem() { Console.WriteLine("\nAmount of items to add"); item = Convert.ToInt32(Console.ReadLine()); // initialize static vars to correct size, now that we have #items product = new string[item]; code = new string[item]; price = new string[item]; unit = new string[item]; Console.WriteLine("Insert the items."); for (int i = 0; i &lt; item; i++) { Console.WriteLine("\nItem[" + i + "]: "); Console.Write("Product[" + i + "]: "); product[i] = Console.ReadLine(); Console.Write("Code[" + i + "]: "); code[i] = Console.ReadLine(); Console.Write("Price[" + i + "]: "); price[i] = Console.ReadLine(); Console.Write("Unit[" + i + "]: "); unit[i] = Console.ReadLine(); } } </code></pre> <p>You can see the fixed code in action at <a href="https://dotnetfiddle.net/n5lWTQ" rel="nofollow">https://dotnetfiddle.net/n5lWTQ</a> !</p>