private void cmdEdit_Click(object sender, EventArgs e) { if (lstMachineProfiles.SelectedIndex != -1) { string fn = FNFromIndex(lstMachineProfiles.SelectedIndex); if (fn != null) { MachineConfig mc = null; if (UVDLPApp.Instance().m_printerinfo.m_filename.Equals(fn)) { mc = UVDLPApp.Instance().m_printerinfo; // current machine profile } else { mc = new MachineConfig(); // existing but not current mc.Load(fn); } frmMachineConfig maccfg = new frmMachineConfig(ref mc); maccfg.Show(); } } }