private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewColumn column = dataGridView1.Columns[e.ColumnIndex]; if (column is DataGridViewButtonColumn) { int status = int.Parse(this.dataGridView1.CurrentRow.Cells["status"].Value.ToString()); if (status == 15 || status == 20) { MessageBox.Show("当前任务已完成"); return; } long id = long.Parse(this.dataGridView1.CurrentRow.Cells["id"].Value.ToString()); string taskCode = this.dataGridView1.CurrentRow.Cells["PackTaskCode"].Value.ToString(); decimal orderCount = decimal.Parse(this.dataGridView1.CurrentRow.Cells["orderCount"].Value.ToString()); int standNum = int.Parse(this.dataGridView1.CurrentRow.Cells["StandNum"].Value.ToString()); int orderNum = int.Parse(this.dataGridView1.CurrentRow.Cells["orderNum"].Value.ToString()); string processDes = this.dataGridView1.CurrentRow.Cells["progressDes"].Value.ToString(); string warehouseName = this.dataGridView1.CurrentRow.Cells["warehouseName"].Value == null?"": this.dataGridView1.CurrentRow.Cells["warehouseName"].Value.ToString(); //这里可以编写你需要的任意关于按钮事件的操作~ WeightForm weightForm = new WeightForm(id, taskCode, orderCount, standNum, processDes, orderNum); weightForm.wareHouseName = warehouseName; if (weightForm.ShowDialog() == DialogResult.OK) { BindDgv(); } } } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewColumn column = dataGridView1.Columns[e.ColumnIndex]; if (column is DataGridViewButtonColumn) { //这里可以编写你需要的任意关于按钮事件的操作~ WeightForm weightForm = new WeightForm(); if (weightForm.ShowDialog() == DialogResult.OK) { } } } }