I am trying to add number of buttons in container of a Panel in window Form, my implementation is as follows:
protected override void Order_Click(object sender, EventArgs e)
{
Menu = new MenuForm();
CatButtons = new Button[5];
CatButtons[0] = new Button();
CatButtons[0].Text = "ljjih";
CatButtons[0].Click += new System.EventHandler(btn_Click);
Menu.Cat_Panel.Container.Add(CatButtons[0]);
}
I keep getting System.NullReferenceException at the last line
Menu.Cat_Panel.Container.Add(CatButtons[0]);
Note : CatButtons and Menu are already declared globally