Please help! I don't know if maybe this is too simple but I can't get it right and can't seem to find the right answer on other posts. I am relatively new to C# and I program for hobby only, this is my first post.
I have this method CreateMap() inside a class Met where I have all my methods. It creates an array of dynamic custom controls (stockBox[]) and adds them to a table layout panel (boxContainer) which is inside Form. This method runs when the application opens. I get everything to work fine, THE ISSUE is that I want to access the stockBox controls from another method inside the same class I can't see stockBox with IntelliSense and it says it doesn't exist!
public static class Met
{
    public static StockBox[] CreateMap(string[] stock, TableLayoutPanel boxContainer)
    {
        StockBox[] stockBox = new StockBox[Var.stockCount + 1];
        for (int i = 1; i <= Var.stockCount; i++)
        {
            stockBox[i] = new StockBox();
            stockBox[i].StockText = stock[i];
            boxContainer.Controls.Add(stockBox[i]);
        }
        return stockBox;
    }
}
Can't place StockBox[] stockBox = new StockBox[Var.stockCount + 1] outside the method because then Var.stockCount is 0 and it will create an array with only one object.
Any ideas? What do you think I can do? Thanks in advance.