private void btnAdd_Click(object sender, EventArgs e) { var rows = dataGridView1.SelectedRows; string mcid = rows[0].Cells[2].Value.ToString(); MemberDatilList DatilList = new MemberDatilList(); DatilList.Tag = mcid; DatilList.Show(); }
//private void btnAdd_Click(object sender, EventArgs e) //{ // MemberInfo mi = new MemberInfo(); // mi.MName = txtMName2.Text; // mi.MPhone = txtMPhone2.Text; // mi.MTypeId = Convert.ToInt32(txtMType.SelectedValue); // mi.MCId = txtMCId.Text; // mi.MStartDate = DateTime.Now; // // mi.MEndDate = DateTime.Now.AddDays(); // if (btnAdd.Text.Equals("添加")) // { // if (miBll.Add(mi)) // { // LoadList(); // } // else // { // MessageBox.Show("添加失败,请稍后重试"); // } // } // else // { // mi.MId = Convert.ToInt32(txtMId.Text); // if (miBll.Edit(mi)) // { // btnQuit_Click(null, null); // LoadList(); // } // else // { // MessageBox.Show("修改失败,请稍后重试"); // } // } //var row = dataGridView1.Rows[e.RowIndex]; //txtMId.Text = row.Cells[0].Value.ToString(); //txtMName2.Text = row.Cells[1].Value.ToString(); //txtMPhone2.Text = row.Cells[4].Value.ToString(); //txtMCId.Text = row.Cells[2].Value.ToString(); //btnAdd.Text = "修改"; //} private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { string mcid = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(); MemberDatilList mdiList = new MemberDatilList(); mdiList.UpdateTypeEvent += UpdateType; mdiList.Tag = mcid; mdiList.Show(); } catch { } }