private void toolStripLabel2_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TextReader reader = new StreamReader(dialog.FileName); XmlSerializer serializer = new XmlSerializer(Cabinet.GetType()); Cabinet = (CabinetGenerator)serializer.Deserialize(reader); reader.Close(); } }