Calculations in a datagridview

0

I want to make a table with a datagridview to enter with textbox data for example a column that is of loan another of interest another of payment to the week and the last the total In the total goes the result of the operation of (loan * interest) + loan - pegosemanal = TOTAL

Then I want the data grid to fill up until the TOTAL results in 0

btnCalcular code

        //Nuevos renglones
         int nuevo = dgvTablaCalculo.Rows.Add();

        decimal prestamo = Convert.ToDecimal(txtPrestamo.Text);


            int interes = Convert.ToInt32(txtInteres.Text);
            decimal dinteres = (decimal)interes / 100;

            decimal pagoSemanal = Convert.ToDecimal(txtPagoSemanal.Text);
            decimal total = (prestamo * dinteres) + prestamo - pagoSemanal;


            dgvTablaCalculo.Rows[nuevo].Cells[0].Value = prestamo;
            dgvTablaCalculo.Rows[nuevo].Cells[1].Value = interes;
            dgvTablaCalculo.Rows[nuevo].Cells[2].Value = pagoSemanal;
            dgvTablaCalculo.Rows[nuevo].Cells[3].Value = total;

        //total = (prestamo * interes) + prestamo - pagoSemanal;


        txtPrestamo.Text = "";
        txtInteres.Text = "";
        txtPagoSemanal.Text = "";
    
asked by Laura Vr 08.12.2018 в 20:09
source

0 answers