private void btnEditar_Click(object sender, EventArgs e) { FormActualizarVenta frm = new FormActualizarVenta(); if (dataGridView1.SelectedRows.Count > 0) { frm.textBox4.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); frm.dateTimePicker1.Value = Convert.ToDateTime(dataGridView1.CurrentRow.Cells[1].Value.ToString()); frm.textBox1.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); frm.textBox2.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); frm.textBox3.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); frm.label8.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString(); frm.label9.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString(); frm.label6.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString(); frm.label10.Text = dataGridView1.CurrentRow.Cells[8].Value.ToString(); frm.FormClosed += new FormClosedEventHandler(form2_FormClosed); frm.ShowDialog(); } else { MessageBox.Show("Debe seleccionar una fila"); } }
private void button1_Click(object sender, EventArgs e) { if (validar == 1) { FormIngresarVenta frm = Owner as FormIngresarVenta; if (dataGridView1.SelectedRows.Count > 0) { frm.label10.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); frm.textBox1.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString() + " " + dataGridView1.CurrentRow.Cells[3].Value.ToString(); this.Close(); } else { MessageBox.Show("Debe seleccionar una fila"); } } if (validar == 2) { FormActualizarVenta frm = Owner as FormActualizarVenta; if (dataGridView1.SelectedRows.Count > 0) { frm.textBox1.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString() + " " + dataGridView1.CurrentRow.Cells[3].Value.ToString(); frm.label10.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); this.Close(); } else { MessageBox.Show("Debe seleccionar una fila"); } } }