Q: C# static winform controls not appearing Initially I was rather confused. I am starting to understand my code is skipping the second for because my NUD array is static. My setup is this.
Controls.cs is a partial class for AranockCompanion.cs my main winform. I have all of my controls (labels, numiercUpDownS, buttons, textBoxs) which are not created in the designer (programmatically rather) in this file. Then I have 1 file for Enums.cs and one for GameData.cs (basically initializing arrays with information) and one for basic FileIO.cs.
Because of my fileWriting method to dump information about items into a file, I had to make it static. I think it had something to do with the StreamWriter IIRC. So then I had to make my array static/public in the Controls class to access it. Now because it is static.. this happens.
I feel like there is some rather basic underlying issue with static / new / objects and the fundamentals of OOP and the general design of how I have my project setup, but I cannot put my finger on it for the life of me.
Why would the code skip executing a loop prematurely without any type of error and successfully launch the program???
    //Equipment Tab Page
    Label[] equipLabels = new Label[skillTotal];
    public static NumericUpDown[] equipCore = new NumericUpDown[skillTotal];
    NumericUpDown[] equipReq = new NumericUpDown[skillTotal];


                #region Equipment
        MessageBox.Show("0_" + skillTotal);
        x = labelEquipSkill.Location.X - panelEquip.Location.X;
        for (int skillCount = 0; skillCount < skillTotal; skillCount++)
        {
            equipLabels[skillCount] = new Label();
            panelEquip.Controls.Add(equipLabels[skillCount]);
            equipLabels[skillCount].Text = GameData.skillsAll[skillCount];
            equipLabels[skillCount].Location = new System.Drawing.Point(x, skillCount * spacer);
            equipLabels[skillCount].Size = new System.Drawing.Size(50, 15);
        }
        MessageBox.Show("1_" + skillTotal);
        x = labelEquipBase.Location.X - panelEquip.Location.X ;
        for (int skillCount = 0; skillCount < skillTotal; skillCount++)
        {
            equipCore[skillCount] = new NumericUpDown();
            panelEquip.Controls.Add(equipCore[skillCount]);
            equipCore[skillCount].Minimum = 0;
            equipCore[skillCount].Maximum = 255;
            equipCore[skillCount].Value = 0;
            //equipCore[skillCount].Text = GameData.skillsAll[skillCount]; 
            equipCore[skillCount].Location = new System.Drawing.Point(x, skillCount * spacer);
            equipCore[skillCount].Size = new System.Drawing.Size(50, 15);
        }

        MessageBox.Show("2_" + skillTotal);
        x = labelEquipReq.Location.X - panelEquip.Location.X;
        for (int skillCount = 0; skillCount < skillTotal; skillCount++)
        {
            equipReq[skillCount] = new NumericUpDown();
            panelEquip.Controls.Add(equipReq[skillCount]);
            equipReq[skillCount].Minimum = 0;
            equipReq[skillCount].Maximum = 255;
            equipReq[skillCount].Value = 0;
            //equipReq[skillCount].Text = GameData.skillsAll[skillCount];
            equipReq[skillCount].Location = new System.Drawing.Point(x, skillCount * spacer);
            equipReq[skillCount].Size = new System.Drawing.Size(50, 15);
        }
        #endregion


    private void buttonVisible_Click(object sender, EventArgs e)
    {
        for (int rc = 0; 0 < skillTotal; rc++)
        {
            MessageBox.Show("" + rc);
            //equipCore[rc].Visible = true;
            equipReq[rc].Visible = true;
        }
    }

equipCore[rc].Visible results in IndexOutOfRangeException.
equipReq[rc].Visible results in Object reference not set to an instance of an object.
Both at index 0.
Which would logically follow that the 3rd for statement is never executed because of an error during the 2nd for. I confirmed the 3rd is fine by commenting out the 2nd.
Any explanation or help would be appreciated.

A: With such a vague, not-very-useful code example, it's impossible to say for sure what is wrong.
That said, IndexOutOfRangeException, along with that apparently you are initializing the equipCore array once, using a field initializer, suggests that at the time it's initialized, the skillTotal variable is still set to its default value of 0, instead of the 59 you expected to be.
As far as the NullReferenceException, that's to be expected if your code throws an exception before populating any of the members of equipReq. I presume that if you fix the initialization of equipCore, both exceptions will go away.
I hesitate to even post the above as an answer, except that it seems to be about as specific an answer as could be provided given the code example. If this is not enough information to help you find the error in your code, please post a (much) better code example. See How to create a Minimal, Complete, and Verifiable example and How do I ask a good question? for good advice on how to post a good, useful question.
