private void dataGridView1_DoubleClick(object sender, EventArgs e) { movement_param movement_param = (movement_param)this.Owner; if (movement_param.dataGridView2.Rows.Count > 0) { if (movement_param.dataGridView2.CurrentRow.Cells[0].Value.ToString().Length != 0) { SystemSounds.Beep.Play(); MessageBox.Show("Профессия уже выбрана!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } string profession = dataGridView1.CurrentRow.Cells[0].Value.ToString(); if (movement_param.dataGridView2.Rows.Count == 0) { movement_param.dataGridView2.Rows.Add("", ""); movement_param.dataGridView2.Rows[0].Cells[0].Value = profession; this.Close(); } else { movement_param.dataGridView2.Rows[0].Cells[0].Value = profession; this.Close(); } }
////////////////////////////////////////////////////// private void button1_Click(object sender, EventArgs e) { movement_param movement_param = new movement_param(); movement_param.Owner = this; movement_param.ShowDialog(); }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { movement_param movement_param = (movement_param)this.Owner; movement_param.label4.Visible = true; movement_param.label4.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); this.Close(); }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { movement_param movement_param = (movement_param)this.Owner; if (movement_param.dataGridView1.Rows.Count > 0) { SystemSounds.Beep.Play(); MessageBox.Show("Сотрудник уже выбран!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } string id = dataGridView1.CurrentRow.Cells[0].Value.ToString(); string fio = dataGridView1.CurrentRow.Cells[1].Value.ToString(); string profession = dataGridView1.CurrentRow.Cells[2].Value.ToString(); string department = dataGridView1.CurrentRow.Cells[3].Value.ToString(); movement_param.dataGridView1.Rows.Add(id, fio, profession, department); this.Close(); }