private void AddGridView() { var gvc = new GridViewCustom(); gvc.ShowDialog(this); if (gvc.DialogResult == DialogResult.OK) { var cg = new configurationGrid { Columns = gvc.Cols, Rows = gvc.Rows, name = gvc.GridName, FullScreen = gvc.FullScreen, AlwaysOnTop = gvc.AlwaysOnTop, Display = gvc.Display, Framerate = gvc.Framerate, ModeIndex = gvc.Mode, Fill = gvc.Fill, ModeConfig = gvc.ModeConfig, ShowAtStartup = gvc.ShowAtStartup, GridItem = new configurationGridGridItem[] { } }; List <configurationGrid> l = MainForm.Conf.GridViews.ToList(); l.Add(cg); MainForm.Conf.GridViews = l.ToArray(); MainClass.ShowGridView(cg.name); LoadGrids(); } gvc.Dispose(); }