private void my_menu_Itemclicked(object sender, ToolStripItemClickedEventArgs e) { if (flag == false) { if (e.ClickedItem.Name == "ColHidden") { dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Visible = false; flag = true; } else if (e.ClickedItem.Name == "ColEdit") { mymenu.Visible = false; DialogResult result = MessageBox.Show("¿ESTA SEGURO QUE DESEA ELIMINAR LA CAJA?", "GESTION CAJA", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes) { eliminaCaja(dataGridView1.CurrentRow.Cells[0].Value.ToString()); } flag = true; } else if (e.ClickedItem.Name == "ColView") { mymenu.Visible = false; mymenu.Enabled = false; DialogResult result = MessageBox.Show("¿ESTA SEGURO QUE DESEA CERRAR LA CAJA?", "GESTION CAJA", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes) { var forma = new frm_cierreCaja(dataGridView1.CurrentRow.Cells[0].Value.ToString(), dataGridView1.CurrentRow.Cells[1].Value.ToString(), dataGridView1.CurrentRow.Cells[7].Value.ToString(), dataGridView1.CurrentRow.Cells[5].Value.ToString()); if (forma.ShowDialog() == DialogResult.OK) { button4.PerformClick(); } } flag = true; } else if (e.ClickedItem.Name == "ColDet") { mymenu.Visible = false; mymenu.Enabled = false; if (dataGridView1.RowCount > 0) { bool cast = false; if (comboBox5.Text == "CERRADAS") { cast = true; } var forma = new frm_detalleCaja(dataGridView1.CurrentRow.Cells[0].Value.ToString(), dataGridView1.CurrentRow.Cells[7].Value.ToString(), dataGridView1.CurrentRow.Cells[1].Value.ToString(), dataGridView1.CurrentRow.Cells[8].Value.ToString(), dataGridView1.CurrentRow.Cells[2].Value.ToString(), dataGridView1.CurrentRow.Cells[3].Value.ToString(), dataGridView1.CurrentRow.Cells[4].Value.ToString(), rolUs, dataGridView1.CurrentRow.Cells[5].Value.ToString(), cast, dataGridView1.CurrentRow.Cells[9].Value.ToString()); forma.ShowDialog(); } flag = true; } } }
private void dataGridView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { e.SuppressKeyPress = true; if (dataGridView1.RowCount > 0) { bool cast = false; if (comboBox5.Text == "CERRADAS") { cast = true; } var forma = new frm_detalleCaja(dataGridView1.CurrentRow.Cells[0].Value.ToString(), dataGridView1.CurrentRow.Cells[7].Value.ToString(), dataGridView1.CurrentRow.Cells[1].Value.ToString(), dataGridView1.CurrentRow.Cells[8].Value.ToString(), dataGridView1.CurrentRow.Cells[2].Value.ToString(), dataGridView1.CurrentRow.Cells[3].Value.ToString(), dataGridView1.CurrentRow.Cells[4].Value.ToString(), rolUs, dataGridView1.CurrentRow.Cells[5].Value.ToString(), cast, dataGridView1.CurrentRow.Cells[9].Value.ToString()); forma.ShowDialog(); } } }