我正在尝试创建一个新表单,然后将其添加到列表中,但出现错误:Object reference not set to an instance of an object.
这是我的代码:
List<Form> Forms;
public void addform()
{
string name = "FormName";
Form newform = new Form();
newform.Name = name;
newform.Text = newform.Name;
newform.ShowDialog();
Forms.Add(newform); //I get the error here
}