public static PersonnelAccess CreateInstrance() { if (frm == null || frm.IsDisposed) { frm = new PersonnelAccess(); } return(frm); }
private void listView2_SelectedIndexChanged(object sender, EventArgs e) { //try //{ ListView.SelectedIndexCollection indexes = this.listView2.SelectedIndices; if (indexes.Count > 0) { int index = indexes[0]; string sPartNo = this.listView2.Items[index].SubItems[0].Text; //获取第一列的值 string sPartName = this.listView2.Items[index].SubItems[1].Text; //获取第二列的值 PersonnelAccess pa = PersonnelAccess.CreateInstrance(); pa.name1 = sPartNo; pa.name2 = sPartName; pa.Show(); } //} //catch (Exception ex) //{ // MessageBox.Show("操作失败!\n" + ex.Message, "提示", MessageBoxButtons.OK, // MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); //} }