private void dgvPlan_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0 || btnEdit.Enabled == false) { return; } frmAddPlan_Add add = new frmAddPlan_Add(); add.Left = this.Left + (this.Width - add.Width) / 2; add.Top = this.Top + (this.Height - add.Height) / 2; add.isEdit = true; add.dgv = this.dgvPlan; add.state = this.labState.Text; add.planID = dgvPlan.Rows[e.RowIndex].Cells[1].Value.ToString(); add.planName = dgvPlan.Rows[e.RowIndex].Cells[2].Value.ToString(); add.planAlias = dgvPlan.Rows[e.RowIndex].Cells[3].Value.ToString(); add.dtStart = Convert.ToDateTime(dgvPlan.Rows[e.RowIndex].Cells[4].Value); add.dtEnd = Convert.ToDateTime(dgvPlan.Rows[e.RowIndex].Cells[6].Value); add.planPost = dgvPlan.Rows[e.RowIndex].Cells[7].Value.ToString(); add.planRoute = dgvPlan.Rows[e.RowIndex].Cells[8].Value.ToString(); add.planInterval = dgvPlan.Rows[e.RowIndex].Cells[9].Value.ToString(); add.planUnit = dgvPlan.Rows[e.RowIndex].Cells[10].Value.ToString(); add.dtEffect = Convert.ToDateTime(dgvPlan.Rows[e.RowIndex].Cells[11].Value); add.dtIneffect = Convert.ToDateTime(dgvPlan.Rows[e.RowIndex].Cells[12].Value); add.ShowDialog(); }
private void btnNew_Click(object sender, EventArgs e) { frmAddPlan_Add add = new frmAddPlan_Add(); add.Left = this.Left + (this.Width - add.Width) / 2; add.Top = this.Top + (this.Height - add.Height) / 2; add.dgv = this.dgvPlan; add.state = this.labState.Text; add.Show(); }
private void btnEdit_Click(object sender, EventArgs e) { int count = 0, rowindex = 0; for (int i = 0; i < dgvPlan.Rows.Count; i++) { try { if ((bool)dgvPlan.Rows[i].Cells[0].Value == true) { count++; rowindex = i; } } catch { continue; } } if (count != 1) { MessageBox.Show("请选择一个要编辑的计划"); return; } frmAddPlan_Add add = new frmAddPlan_Add(); add.Left = this.Left + (this.Width - add.Width) / 2; add.Top = this.Top + (this.Height - add.Height) / 2; add.isEdit = true; add.dgv = this.dgvPlan; add.state = this.labState.Text; add.planID = dgvPlan.Rows[rowindex].Cells[1].Value.ToString(); add.planName = dgvPlan.Rows[rowindex].Cells[2].Value.ToString(); add.planAlias = dgvPlan.Rows[rowindex].Cells[3].Value.ToString(); add.dtStart = Convert.ToDateTime(dgvPlan.Rows[rowindex].Cells[4].Value); add.dtEnd = Convert.ToDateTime(dgvPlan.Rows[rowindex].Cells[6].Value); add.planPost = dgvPlan.Rows[rowindex].Cells[7].Value.ToString(); add.planRoute = dgvPlan.Rows[rowindex].Cells[8].Value.ToString(); add.planInterval = dgvPlan.Rows[rowindex].Cells[9].Value.ToString(); add.planUnit = dgvPlan.Rows[rowindex].Cells[10].Value.ToString(); add.dtEffect = Convert.ToDateTime(dgvPlan.Rows[rowindex].Cells[11].Value); add.dtIneffect = Convert.ToDateTime(dgvPlan.Rows[rowindex].Cells[12].Value); add.Show(); }
private void btnEdit_Click(object sender, EventArgs e) { int count = 0,rowindex=0; for (int i = 0; i < dgvPlan.Rows.Count; i++) { try { if ((bool)dgvPlan.Rows[i].Cells[0].Value == true) { count++; rowindex = i; } } catch { continue; } } if (count !=1) { MessageBox.Show("请选择一个要编辑的计划"); return; } frmAddPlan_Add add = new frmAddPlan_Add(); add.Left = this.Left + (this.Width - add.Width) / 2; add.Top = this.Top + (this.Height - add.Height) / 2; add.isEdit = true; add.dgv = this.dgvPlan; add.state = this.labState.Text; add.planID = dgvPlan.Rows[rowindex].Cells[1].Value.ToString(); add.planName = dgvPlan.Rows[rowindex].Cells[2].Value.ToString(); add.planAlias = dgvPlan.Rows[rowindex].Cells[3].Value.ToString(); add.dtStart = Convert.ToDateTime(dgvPlan.Rows[rowindex].Cells[4].Value); add.dtEnd = Convert.ToDateTime(dgvPlan.Rows[rowindex].Cells[6].Value); add.planPost = dgvPlan.Rows[rowindex].Cells[7].Value.ToString(); add.planRoute = dgvPlan.Rows[rowindex].Cells[8].Value.ToString(); add.planInterval = dgvPlan.Rows[rowindex].Cells[9].Value.ToString(); add.planUnit = dgvPlan.Rows[rowindex].Cells[10].Value.ToString(); add.dtEffect = Convert.ToDateTime(dgvPlan.Rows[rowindex].Cells[11].Value); add.dtIneffect = Convert.ToDateTime(dgvPlan.Rows[rowindex].Cells[12].Value); add.Show(); }
private void dgvPlan_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if(e.RowIndex<0||btnEdit.Enabled==false) return; frmAddPlan_Add add = new frmAddPlan_Add(); add.Left = this.Left + (this.Width - add.Width) / 2; add.Top = this.Top + (this.Height - add.Height) / 2; add.isEdit = true; add.dgv = this.dgvPlan; add.state = this.labState.Text; add.planID = dgvPlan.Rows[e.RowIndex].Cells[1].Value.ToString(); add.planName = dgvPlan.Rows[e.RowIndex].Cells[2].Value.ToString(); add.planAlias = dgvPlan.Rows[e.RowIndex].Cells[3].Value.ToString(); add.dtStart = Convert.ToDateTime(dgvPlan.Rows[e.RowIndex].Cells[4].Value); add.dtEnd = Convert.ToDateTime(dgvPlan.Rows[e.RowIndex].Cells[6].Value); add.planPost = dgvPlan.Rows[e.RowIndex].Cells[7].Value.ToString(); add.planRoute = dgvPlan.Rows[e.RowIndex].Cells[8].Value.ToString(); add.planInterval = dgvPlan.Rows[e.RowIndex].Cells[9].Value.ToString(); add.planUnit = dgvPlan.Rows[e.RowIndex].Cells[10].Value.ToString(); add.dtEffect = Convert.ToDateTime(dgvPlan.Rows[e.RowIndex].Cells[11].Value); add.dtIneffect = Convert.ToDateTime(dgvPlan.Rows[e.RowIndex].Cells[12].Value); add.ShowDialog(); }
private void btnNew_Click(object sender, EventArgs e) { frmAddPlan_Add add = new frmAddPlan_Add(); add.Left = this.Left + (this.Width - add.Width) / 2; add.Top = this.Top +(this.Height - add.Height) / 2; add.dgv = this.dgvPlan; add.state = this.labState.Text; add.Show(); }