private void GridPagos_CellClick(object sender, DataGridViewCellEventArgs e) { try { int IDPrest = int.Parse(GridPagos.Rows[e.RowIndex].Cells[0].Value.ToString()); decimal totalPagos = 0; DB = new Conexion(); EstePrestamo = new Prestamo(); if (EstePrestamo.Fill(IDPrest)) { Pago p = new Pago(); totalPagos = p.GetTotalPagos(IDPrest); montoPrestamo = Convert.ToDecimal(GridPagos.Rows[e.RowIndex].Cells["Monto"].Value.ToString()); TBCuota.Text = EstePrestamo.getCouta().ToString(); //-- //GridPagos.Rows[e.RowIndex].Cells["Cuota"].Value.ToString(); TBMontoInteres.Text = EstePrestamo.GetMontoInteres().ToString(); TBIDPrestamo.Text = EstePrestamo.ID_Prestamo.ToString(); TBFechaPrestamo.Text = EstePrestamo.Fecha.ToString(); try { TBFechafin.Text = EstePrestamo.GetFechaFin().ToString(); } catch (Exception es) { MessageBox.Show("Error calculando Fecha fin " + es.Message); } TBBalancePendiente.Text = EstePrestamo.GetBalancePendiente().ToString(); TBMora.Text = EstePrestamo.GetMora().ToString(); if (EstePrestamo.LineaCredito) { TBTotalPago.Text = TBCuota.Text; } else { TBTotalPago.Text = (decimal.Parse(TBCuota.Text) + EstePrestamo.GetMora()).ToString(); } string Query = "select porcentaje from taza t join tbl_prestamos p on " + " p.taza = t.id_taza where p.id_prestamo = " + TBIDPrestamo.Text; _PorcentajePrestamo = decimal.Parse(DB.GetData(Query).Rows[0]["porcentaje"].ToString()); } } catch (Exception es) { MessageBox.Show(es.Message); } }