private void dtDatos_CellClick(object sender, DataGridViewCellEventArgs e) { int Ncolumna = 0; Ncolumna = e.ColumnIndex; if (Ncolumna == 0 && imagen < 1) { int sum; sum = Ncolumna + 31; Busqueda frmBusqueda = new Busqueda(sum); frmBusqueda.ShowDialog(); if (!string.IsNullOrEmpty(frmBusqueda.dato)) { string tempDescrip = Bom.BuscarThread(frmBusqueda.dato); dtDatos.CurrentRow.Cells[0].Value = tempDescrip; dtDatos.CurrentRow.Cells[2].Value = tempDescrip; } } if (Ncolumna == 1 && imagen < 1) { if (dtDatos.Rows.Count > 0) { int sum; sum = Ncolumna + 40; Input frm = new Input(sum, ""); frm.ShowDialog(); dtDatos.CurrentCell.Value = frm.dato; if (!string.IsNullOrEmpty(dtDatos.CurrentRow.Cells[1].Value.ToString()) && dtDatos.CurrentRow.Cells[3].Value != null) { dtDatos.CurrentRow.Cells[4].Value = float.Parse((dtDatos.CurrentRow.Cells[1].Value.ToString())) + float.Parse((dtDatos.CurrentRow.Cells[3].Value.ToString())); } } else { int sum; sum = Ncolumna + 40; Input frm = new Input(sum, "0"); frm.ShowDialog(); dtDatos.CurrentCell.Value = frm.dato; if (!string.IsNullOrEmpty(dtDatos.CurrentRow.Cells[1].Value.ToString()) && !string.IsNullOrEmpty(dtDatos.CurrentRow.Cells[3].Value.ToString())) { dtDatos.CurrentRow.Cells[4].Value = float.Parse(dtDatos.CurrentRow.Cells[1].Value.ToString()) + float.Parse(dtDatos.CurrentRow.Cells[1].Value.ToString()); } } } if (Ncolumna == 3 && imagen < 1) { if (dtDatos.Rows.Count > 0) { int sum; sum = Ncolumna + 40; Input frm = new Input(sum, ""); frm.ShowDialog(); dtDatos.CurrentCell.Value = frm.dato; if (!string.IsNullOrEmpty(dtDatos.CurrentRow.Cells[3].Value.ToString()) && dtDatos.CurrentRow.Cells[1].Value != null) { dtDatos.CurrentRow.Cells[4].Value = float.Parse((dtDatos.CurrentRow.Cells[1].Value.ToString())) + float.Parse((dtDatos.CurrentRow.Cells[3].Value.ToString())); } } else { int sum; sum = Ncolumna + 40; Input frm = new Input(sum, "0"); frm.ShowDialog(); dtDatos.CurrentCell.Value = frm.dato; if (!string.IsNullOrEmpty(dtDatos.CurrentRow.Cells[1].Value.ToString()) && !string.IsNullOrEmpty(dtDatos.CurrentRow.Cells[3].Value.ToString())) { dtDatos.CurrentRow.Cells[4].Value = float.Parse(dtDatos.CurrentRow.Cells[1].Value.ToString()) + float.Parse(dtDatos.CurrentRow.Cells[1].Value.ToString()); } } } if (Ncolumna == 5 && imagen < 1) { if (dtDatos.Rows.Count > 0) { int sum; sum = Ncolumna + 20; Input frm = new Input(sum, ""); frm.ShowDialog(); dtDatos.CurrentCell.Value = frm.dato; } else { int sum; sum = Ncolumna + 20; Input frm = new Input(sum, ""); frm.ShowDialog(); dtDatos.CurrentCell.Value = frm.dato; } } }