C# .NET - Event error

Asked By Ismael on 20-Jul-11 08:43 PM
I just put some code in a cell value changed event of a grid view and im getting this message

 

An unhandled exception of type 'System.StackOverflowException' occurred in WindowsApplication.exe


      this    Cannot obtain value of local or argument '<this>' as it is not available at this instruction pointer, possibly because it has been optimized away.    tphfinal.BalanceForm


I even encapsulated the code in a try catch, but it still crashes
Peter Bromberg replied to Ismael on 20-Jul-11 09:09 PM
You haven't provided sufficient information. A stackoverflow can often be caused by referencing the public field of a property instead of the private field to set a value, but there are many other causes. If you take the time to post sample code, you can expect better answers. 
Ismael replied to Peter Bromberg on 20-Jul-11 09:18 PM
Well its a big code but here you go:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GemBox.Spreadsheet;

namespace tphfinal
{
    public partial class BalanceForm : Form
    {
      public BalanceForm()
      {
        InitializeComponent();
      }

      private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
      {

      }

      private void button1_Click(object sender, EventArgs e)
      {

      



      }

      private void BalanceForm_FormClosing(object sender, FormClosingEventArgs e)
      {
        e.Cancel = true;
        this.Hide();
        this.WindowState = FormWindowState.Normal;
      }

      private void BalanceForm_Load(object sender, EventArgs e)
      {
        this.dataGridView1.Rows.Add(34);
        this.dataGridView2.Rows.Add(35);


        this.dataGridView2.Rows[0].Cells[2].Value = Gasto.Gastomedio1;
        this.dataGridView2.Rows[1].Cells[2].Value = Lodos.Recirculacion1;
        this.dataGridView2.Rows[2].Cells[2].Value = this.dataGridView1.Rows[0].Cells[24].Value;
        this.dataGridView2.Rows[3].Cells[2].Value = Parametros.DBO1;

        this.dataGridView2.Rows[5].Cells[2].Value = Parametros.DBOsoluble1;

        this.dataGridView2.Rows[7].Cells[2].Value = Parametros.DQO1;

        this.dataGridView2.Rows[9].Cells[2].Value = Parametros.DQOsoluble1;

        this.dataGridView2.Rows[11].Cells[2].Value = Parametros.SST1;

        this.dataGridView2.Rows[13].Cells[2].Value = Parametros.Coliformesfecales1;

        this.dataGridView2.Rows[15].Cells[2].Value = Parametros.Coliformestotales1;

        this.dataGridView2.Rows[17].Cells[2].Value = Parametros.Materiaflotante1;
        
        this.dataGridView2.Rows[19].Cells[2].Value = Parametros.SS1;
        this.dataGridView2.Rows[21].Cells[2].ReadOnly = false;
        this.dataGridView2.Rows[22].Cells[2].Value = Parametros.Temperatura1;
        this.dataGridView2.Rows[23].Cells[2].Value = Parametros.Huevos1;

        this.dataGridView2.Rows[25].Cells[2].Value = Parametros.Nitrogeno1;
        this.dataGridView2.Rows[27].Cells[2].Value = Parametros.Nitrogeno_Amoniacal1;

        this.dataGridView2.Rows[29].Cells[2].Value = Parametros.Nitritos1;

        this.dataGridView2.Rows[31].Cells[2].Value = Parametros.Nitratos1;


        this.dataGridView2.Rows[33].Cells[2].Value = Parametros.Fosforo1;
    

        this.dataGridView2.Rows[0].Cells[0].Value = "Gasto de DiseƱo";
        this.dataGridView2.Rows[1].Cells[0].Value = "Gasto de Retorno";
        this.dataGridView2.Rows[2].Cells[0].Value = "Gasto de Retorno 2";
        this.dataGridView2.Rows[3].Cells[0].Value = "DBO5 Influente";
        this.dataGridView2.Rows[4].Cells[0].Value = "DBO5 Efluente";
        this.dataGridView2.Rows[5].Cells[0].Value = "DBO5 Soluble Influente";
        this.dataGridView2.Rows[6].Cells[0].Value = "DBO5 Soluble Efluente";
        this.dataGridView2.Rows[7].Cells[0].Value = "DQO Influente";
        this.dataGridView2.Rows[8].Cells[0].Value = "DQO Efluente";
        this.dataGridView2.Rows[9].Cells[0].Value = "DQO Soluble Influente";
        this.dataGridView2.Rows[10].Cells[0].Value = "DQO Soluble Efluente";
        this.dataGridView2.Rows[11].Cells[0].Value = "SST Inlfuente";
        this.dataGridView2.Rows[12].Cells[0].Value = "SST Efluente";
        this.dataGridView2.Rows[13].Cells[0].Value = "Coliformes Fecales Influente";
        this.dataGridView2.Rows[14].Cells[0].Value = "Coliformes Fecales Efluente";
        this.dataGridView2.Rows[15].Cells[0].Value = "Coliformes Totales Influente";
        this.dataGridView2.Rows[16].Cells[0].Value = "Coliformes Totales Efluente";
        this.dataGridView2.Rows[17].Cells[0].Value = "Materia Flotante";
        this.dataGridView2.Rows[18].Cells[0].Value = "Solidos Sedimentables";
        this.dataGridView2.Rows[19].Cells[0].Value = "Grasas y Aceites Influente";
        this.dataGridView2.Rows[20].Cells[0].Value = "Grasas y Aceites Efluente";
        this.dataGridView2.Rows[21].Cells[0].Value = "Porcentaje de Remocion G/A";
        this.dataGridView2.Rows[22].Cells[0].Value = "Temperatura";
        this.dataGridView2.Rows[23].Cells[0].Value = "Huevos de Helminto Influente";
        this.dataGridView2.Rows[24].Cells[0].Value = "Huevos de Helminto Efluente";
        this.dataGridView2.Rows[25].Cells[0].Value = "Nitrogeno Total Influente";
        this.dataGridView2.Rows[26].Cells[0].Value = "Nitrogeno Total Efluente";
        this.dataGridView2.Rows[27].Cells[0].Value = "Nitrogeno Amoniacal Influente";
        this.dataGridView2.Rows[28].Cells[0].Value = "Nitrogeno Amoniacal Efluente";
        this.dataGridView2.Rows[29].Cells[0].Value = "Nitritos Influente";
        this.dataGridView2.Rows[30].Cells[0].Value = "Nitritos Efluente";
        this.dataGridView2.Rows[31].Cells[0].Value = "Nitratos Influente";
        this.dataGridView2.Rows[32].Cells[0].Value = "Nitratos Efluente";
        this.dataGridView2.Rows[33].Cells[0].Value = "Fosforo Influente";
        this.dataGridView2.Rows[34].Cells[0].Value = "Fosforo Efluente";

        this.dataGridView2.Rows[0].Cells[1].Value = "lt/seg";
        this.dataGridView2.Rows[1].Cells[1].Value = "lt/seg";
        this.dataGridView2.Rows[2].Cells[1].Value = "lt/seg";
        this.dataGridView2.Rows[3].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[4].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[5].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[6].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[7].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[8].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[9].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[10].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[11].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[12].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[13].Cells[1].Value = "NMP/100 ml";
        this.dataGridView2.Rows[14].Cells[1].Value = "NMP/100 ml";
        this.dataGridView2.Rows[15].Cells[1].Value = "NMP/100 ml";
        this.dataGridView2.Rows[16].Cells[1].Value = "NMP/100 ml";
        this.dataGridView2.Rows[17].Cells[1].Value = "Kg/1000 m3";
        this.dataGridView2.Rows[18].Cells[1].Value = "Kg/1000 m3";
        this.dataGridView2.Rows[19].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[20].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[22].Cells[1].Value = "Celsius";
        this.dataGridView2.Rows[23].Cells[1].Value = "Huevos/Lt";
        this.dataGridView2.Rows[24].Cells[1].Value = "Huevos/Lt";
        this.dataGridView2.Rows[25].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[26].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[27].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[28].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[29].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[30].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[31].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[32].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[33].Cells[1].Value = "mg/lt";
        this.dataGridView2.Rows[34].Cells[1].Value = "mg/lt";


    
      
      }

      private void BalanceForm_Activated(object sender, EventArgs e)
      {
        

        //GASTO
        this.dataGridView1.Rows[0].Cells[0].Value = "Gasto";
    
        this.dataGridView1.Rows[0].Cells[1].Value = "l/s";
       

        this.dataGridView1.Rows[1].Cells[0].Value = "Gasto";
       
        this.dataGridView1.Rows[1].Cells[1].Value = "m3/dia";


        this.dataGridView1.Rows[0].Cells[2].Value = Convert.ToDouble(this.dataGridView2.Rows[0].Cells[2].Value);


        this.dataGridView1.Rows[1].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value) * 86400) / 1000;
        

        this.dataGridView1.Rows[0].Cells[17].Value = Lodos.Recirculacion1 * 0.05;
       this.dataGridView1.Rows[1].Cells[17].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value)*86400/1000;


       this.dataGridView1.Rows[0].Cells[3].Value = Gasto.Gastomedio1 + double.Parse(this.dataGridView1.Rows[0].Cells[17].Value.ToString());
        this.dataGridView1.Rows[1].Cells[3].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value) * 86400 / 1000;


        this.dataGridView1.Rows[0].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[3].Cells[4].Value)) * 5 / 86400;

        this.dataGridView1.Rows[1].Cells[5].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[5].Value) * 86400 / 1000;
     

        this.dataGridView1.Rows[0].Cells[6].Value = this.dataGridView1.Rows[0].Cells[5].Value;
        this.dataGridView1.Rows[1].Cells[6].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[7].Value = this.dataGridView1.Rows[0].Cells[3].Value;
        this.dataGridView1.Rows[1].Cells[7].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[7].Value) * 86400 / 1000;
          
        this.dataGridView1.Rows[0].Cells[8].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[7].Value);
        this.dataGridView1.Rows[1].Cells[8].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[10].Value = Convert.ToDouble(this.dataGridView1.Rows[5].Cells[7].Value)*50/86400;
        this.dataGridView1.Rows[1].Cells[10].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[10].Value)*86400/1000;

        this.dataGridView1.Rows[0].Cells[11].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[10].Value)+Convert.ToDouble(this.dataGridView1.Rows[0].Cells[5].Value);
        this.dataGridView1.Rows[1].Cells[11].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[11].Value)*86400/1000;

        this.dataGridView1.Rows[0].Cells[12].Value = this.dataGridView1.Rows[0].Cells[10].Value;
        this.dataGridView1.Rows[1].Cells[12].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[13].Value = this.dataGridView1.Rows[0].Cells[8].Value;
        this.dataGridView1.Rows[1].Cells[13].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value) * 86400 / 1000;

        
        this.dataGridView1.Rows[0].Cells[14].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value);
        this.dataGridView1.Rows[1].Cells[14].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value)*86400/1000;

        this.dataGridView1.Rows[0].Cells[16].Value = this.dataGridView1.Rows[0].Cells[14].Value ;
        this.dataGridView1.Rows[1].Cells[16].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value) * 86400 / 1000;


        this.dataGridView1.Rows[0].Cells[17].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.05;
        this.dataGridView1.Rows[1].Cells[17].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value) * 86400 / 1000;


        this.dataGridView1.Rows[0].Cells[18].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.15;
        this.dataGridView1.Rows[1].Cells[18].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value)*86400/1000;

        this.dataGridView1.Rows[0].Cells[19].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.2;
        this.dataGridView1.Rows[1].Cells[19].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[19].Value)*86400/1000;

        this.dataGridView1.Rows[0].Cells[20].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value);
        this.dataGridView1.Rows[1].Cells[20].Value =Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)*86400/1000;

      
        this.dataGridView1.Rows[0].Cells[22].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.8;
        this.dataGridView1.Rows[1].Cells[22].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[23].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value) + Convert.ToDouble(this.dataGridView2.Rows[2].Cells[2].Value);
        this.dataGridView1.Rows[1].Cells[23].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[24].Value = 147.99 * 0.1;
        this.dataGridView1.Rows[1].Cells[24].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[25].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value) - Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value);
        this.dataGridView1.Rows[1].Cells[25].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[21].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value);
        this.dataGridView1.Rows[1].Cells[21].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value) * 86400 / 1000;
        
        this.dataGridView1.Rows[0].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[1].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[26].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[27].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value);
        this.dataGridView1.Rows[1].Cells[27].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[27].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[28].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[26].Value) - Convert.ToDouble(this.dataGridView1.Rows[0].Cells[27].Value);
        this.dataGridView1.Rows[1].Cells[28].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[28].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[29].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value);
        this.dataGridView1.Rows[1].Cells[29].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[29].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[30].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[28].Value) - Convert.ToDouble(this.dataGridView1.Rows[0].Cells[10].Value);
        this.dataGridView1.Rows[1].Cells[30].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[30].Value) * 86400 / 1000;
        
        
        
        //MATERIA FLOTANTE
        this.dataGridView1.Rows[2].Cells[0].Value = "Materia Flotante";
    
        this.dataGridView1.Rows[2].Cells[1].Value = "kg/dia";
 


        this.dataGridView1.Rows[3].Cells[0].Value = "Materia Flotante";
       
        this.dataGridView1.Rows[3].Cells[1].Value = "l/dia";


        this.dataGridView1.Rows[2].Cells[2].Value = Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value) * 0.5/1000;

        this.dataGridView1.Rows[3].Cells[2].Value = Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value) + Convert.ToDouble(this.dataGridView1.Rows[17].Cells[2].Value);
      
    

    

        this.dataGridView1.Rows[2].Cells[3].Value = this.dataGridView1.Rows[2].Cells[2].Value;
        this.dataGridView1.Rows[3].Cells[3].Value = this.dataGridView1.Rows[3].Cells[2].Value;
        this.dataGridView1.Rows[2].Cells[4].Value = this.dataGridView1.Rows[2].Cells[2].Value;
        this.dataGridView1.Rows[3].Cells[4].Value = this.dataGridView1.Rows[3].Cells[2].Value;

        //SOLIDOS SEDIMENTABLES

        this.dataGridView1.Rows[4].Cells[0].Value = "Solidos Sedimentables";
     
        this.dataGridView1.Rows[4].Cells[1].Value = "kg/dia";
      


        this.dataGridView1.Rows[5].Cells[0].Value = "Solidos Sedimentables";
    
        this.dataGridView1.Rows[5].Cells[1].Value = "l/dia";



        this.dataGridView1.Rows[4].Cells[2].Value = Convert.ToDouble(this.dataGridView1.Rows[18].Cells[2].Value);


        this.dataGridView1.Rows[5].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[4].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);
   
        this.dataGridView1.Rows[4].Cells[3].Value = this.dataGridView1.Rows[4].Cells[2].Value;
        this.dataGridView1.Rows[5].Cells[3].Value = this.dataGridView1.Rows[5].Cells[2].Value;

        this.dataGridView1.Rows[4].Cells[7].Value = this.dataGridView1.Rows[4].Cells[2].Value;
        this.dataGridView1.Rows[5].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[4].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);

        this.dataGridView1.Rows[4].Cells[8].Value = this.dataGridView1.Rows[4].Cells[2].Value;
        this.dataGridView1.Rows[5].Cells[8].Value = this.dataGridView1.Rows[5].Cells[7].Value;

        this.dataGridView1.Rows[4].Cells[9].Value = this.dataGridView1.Rows[4].Cells[2].Value;
        this.dataGridView1.Rows[5].Cells[9].Value = this.dataGridView1.Rows[5].Cells[7].Value;

        
     //DBO5

        this.dataGridView1.Rows[6].Cells[0].Value = "DBO";
 
        this.dataGridView1.Rows[6].Cells[1].Value = "mg/lt";
       


        this.dataGridView1.Rows[7].Cells[0].Value = "DBO";
      
        this.dataGridView1.Rows[7].Cells[1].Value = "kg/dia ";

        //1
        this.dataGridView1.Rows[6].Cells[2].Value = this.dataGridView2.Rows[3].Cells[2].Value;
        this.dataGridView1.Rows[7].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[2].Value)/ 1000) *Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);

        
        //2
        this.dataGridView1.Rows[6].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[3].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value))+(Convert.ToDouble(this.dataGridView1.Rows[6].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value)))/Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
     this.dataGridView1.Rows[7].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[3].Value)/ 1000) *Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);

     

        //4
        this.dataGridView1.Rows[6].Cells[5].Value = this.dataGridView2.Rows[4].Cells[2].Value;
        this.dataGridView1.Rows[7].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[5].Value)/ 1000) *Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[6].Cells[6].Value = this.dataGridView1.Rows[6].Cells[5].Value;

        this.dataGridView1.Rows[7].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[6].Cells[7].Value = this.dataGridView1.Rows[6].Cells[3].Value;

        this.dataGridView1.Rows[7].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[6].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[6].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[7].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[6].Cells[10].Value = this.dataGridView1.Rows[6].Cells[5].Value;
        this.dataGridView1.Rows[7].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[6].Cells[11].Value = this.dataGridView1.Rows[6].Cells[5].Value;
        this.dataGridView1.Rows[7].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[6].Cells[12].Value = this.dataGridView1.Rows[6].Cells[5].Value;
        this.dataGridView1.Rows[7].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[6].Cells[13].Value = this.dataGridView1.Rows[6].Cells[8].Value;
        this.dataGridView1.Rows[7].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[6].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[6].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[7].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);

      


        //15
        this.dataGridView1.Rows[6].Cells[16].Value = this.dataGridView1.Rows[6].Cells[14].Value;
        this.dataGridView1.Rows[7].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[6].Cells[17].Value = this.dataGridView1.Rows[6].Cells[30].Value;
        this.dataGridView1.Rows[7].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[6].Cells[18].Value = this.dataGridView1.Rows[6].Cells[30].Value;
        this.dataGridView1.Rows[7].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[6].Cells[19].Value = this.dataGridView1.Rows[6].Cells[30].Value;
        this.dataGridView1.Rows[7].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[6].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[6].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[7].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[6].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[6].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[7].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[6].Cells[22].Value = this.dataGridView1.Rows[6].Cells[30].Value;
        this.dataGridView1.Rows[7].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[6].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[6].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[7].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[6].Cells[24].Value = this.dataGridView1.Rows[6].Cells[23].Value;
        this.dataGridView1.Rows[7].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[6].Cells[25].Value = this.dataGridView1.Rows[6].Cells[23].Value;
        this.dataGridView1.Rows[7].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[6].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[6].Cells[25].Value)/(1 + Convert.ToDouble(this.dataGridView2.Rows[3].Cells[3].Value));
        this.dataGridView1.Rows[7].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[6].Cells[27].Value = this.dataGridView1.Rows[6].Cells[30].Value;
        this.dataGridView1.Rows[7].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[6].Cells[28].Value = this.dataGridView1.Rows[6].Cells[30].Value;
        this.dataGridView1.Rows[7].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[6].Cells[29].Value = this.dataGridView1.Rows[6].Cells[30].Value;
        this.dataGridView1.Rows[7].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[6].Cells[30].Value = this.dataGridView1.Rows[6].Cells[30].Value;
        this.dataGridView1.Rows[7].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);


     //DBO Soluble
        this.dataGridView1.Rows[8].Cells[0].Value = "DBO Soluble";
 
        this.dataGridView1.Rows[8].Cells[1].Value = "mg/lt";
    


        this.dataGridView1.Rows[9].Cells[0].Value = "DBO Soluble";
    
        this.dataGridView1.Rows[9].Cells[1].Value = "kg/dia ";



        //1
        this.dataGridView1.Rows[8].Cells[2].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[9].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[8].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[8].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[9].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[8].Cells[5].Value = this.dataGridView2.Rows[6].Cells[2].Value;
        this.dataGridView1.Rows[9].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[8].Cells[6].Value = this.dataGridView1.Rows[8].Cells[5].Value;

        this.dataGridView1.Rows[9].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[8].Cells[7].Value = this.dataGridView1.Rows[8].Cells[3].Value;

        this.dataGridView1.Rows[9].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[8].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[8].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[9].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9

        this.dataGridView1.Rows[8].Cells[10].Value = this.dataGridView1.Rows[8].Cells[5].Value;
        this.dataGridView1.Rows[9].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[8].Cells[11].Value = this.dataGridView1.Rows[8].Cells[5].Value;
        this.dataGridView1.Rows[9].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[8].Cells[12].Value = this.dataGridView1.Rows[8].Cells[5].Value;
        this.dataGridView1.Rows[9].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[8].Cells[13].Value = this.dataGridView1.Rows[8].Cells[8].Value;
        this.dataGridView1.Rows[9].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[8].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[8].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[9].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[8].Cells[16].Value = this.dataGridView1.Rows[8].Cells[14].Value;
        this.dataGridView1.Rows[9].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[8].Cells[17].Value = this.dataGridView1.Rows[8].Cells[30].Value;
        this.dataGridView1.Rows[9].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[8].Cells[18].Value = this.dataGridView1.Rows[8].Cells[30].Value;
        this.dataGridView1.Rows[9].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[8].Cells[19].Value = this.dataGridView1.Rows[8].Cells[30].Value;
        this.dataGridView1.Rows[9].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[8].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[8].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[9].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[8].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[8].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[9].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[8].Cells[22].Value = this.dataGridView1.Rows[8].Cells[30].Value;
        this.dataGridView1.Rows[9].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[8].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[8].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[9].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[8].Cells[24].Value = this.dataGridView1.Rows[8].Cells[23].Value;
        this.dataGridView1.Rows[9].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[8].Cells[25].Value = this.dataGridView1.Rows[8].Cells[23].Value;
        this.dataGridView1.Rows[9].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[8].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[8].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[9].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[8].Cells[27].Value = this.dataGridView1.Rows[8].Cells[30].Value;
        this.dataGridView1.Rows[9].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[8].Cells[28].Value = this.dataGridView1.Rows[8].Cells[30].Value;
        this.dataGridView1.Rows[9].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[8].Cells[29].Value = this.dataGridView1.Rows[6].Cells[30].Value;
        this.dataGridView1.Rows[9].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[6].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[8].Cells[30].Value = this.dataGridView1.Rows[8].Cells[30].Value;
        this.dataGridView1.Rows[9].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[8].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);



       

        //DQO

        int i = 10;
        int j = 11;
        this.dataGridView1.Rows[10].Cells[0].Value = "DQO";
     
        this.dataGridView1.Rows[10].Cells[1].Value = "mg/lt";
     


        this.dataGridView1.Rows[11].Cells[0].Value = "DQO";
      
        this.dataGridView1.Rows[11].Cells[1].Value = "kg/dia ";





        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);







        //DQO Soluble


        this.dataGridView1.Rows[12].Cells[0].Value = "DQO Soluble";
   
        this.dataGridView1.Rows[12].Cells[1].Value = "mg/lt";



        this.dataGridView1.Rows[13].Cells[0].Value = "DQO Soluble";
    
        this.dataGridView1.Rows[13].Cells[1].Value = "kg/dia ";


        i = 12;
        j = 13;



        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);



        //SST Influente
        this.dataGridView1.Rows[14].Cells[0].Value = "SST";
 
        this.dataGridView1.Rows[14].Cells[1].Value = "mg/lt";
       

        this.dataGridView1.Rows[15].Cells[0].Value = "SST";

        this.dataGridView1.Rows[15].Cells[1].Value = "kg/dia ";




        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);

      

        //Nitrogeno Total
        this.dataGridView1.Rows[16].Cells[0].Value = "Nitrogeno Total";

        this.dataGridView1.Rows[16].Cells[1].Value = "mg/lt";
       


        this.dataGridView1.Rows[17].Cells[0].Value = "Nitrogeno Total";
   
        this.dataGridView1.Rows[17].Cells[1].Value = "kg/dia ";




        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);




        //Nitrogeno Amoniacal
        this.dataGridView1.Rows[18].Cells[0].Value = "Nitrogeno Amoniacal";
   
        this.dataGridView1.Rows[18].Cells[1].Value = "mg/lt";
    


        this.dataGridView1.Rows[19].Cells[0].Value = "Nitrogeno Amoniacal";
   
        this.dataGridView1.Rows[19].Cells[1].Value = "kg/dia ";





        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);



        //Fosforo
        this.dataGridView1.Rows[20].Cells[0].Value = "Fosforo";

        this.dataGridView1.Rows[20].Cells[1].Value = "mg/lt";
      


        this.dataGridView1.Rows[21].Cells[0].Value = "Fosforo";
     
        this.dataGridView1.Rows[21].Cells[1].Value = "kg/dia ";




        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);



        //Grasas y Aceites
        this.dataGridView1.Rows[22].Cells[0].Value = "Grasas y Aceites";
      
        this.dataGridView1.Rows[22].Cells[1].Value = "mg/lt";
       


        this.dataGridView1.Rows[23].Cells[0].Value = "Grasas y Aceites";

        this.dataGridView1.Rows[23].Cells[1].Value = "kg/dia ";




        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);


        //Coliformes Fecales
        this.dataGridView1.Rows[24].Cells[0].Value = "Coliformes Fecales";
       
        this.dataGridView1.Rows[24].Cells[1].Value = "mg/lt";
      


        this.dataGridView1.Rows[25].Cells[0].Value = "Coliformes Fecales";
    
        this.dataGridView1.Rows[25].Cells[1].Value = "kg/dia ";



        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);


        //Coliformes Totales
        this.dataGridView1.Rows[26].Cells[0].Value = "Coliformes Totales";
        
        this.dataGridView1.Rows[26].Cells[1].Value = "mg/lt";
      


        this.dataGridView1.Rows[27].Cells[0].Value = "Coliformes Totales";
      
        this.dataGridView1.Rows[27].Cells[1].Value = "kg/dia ";



        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);


        //Nitritos
        this.dataGridView1.Rows[28].Cells[0].Value = "Nitritos";
   
        this.dataGridView1.Rows[28].Cells[1].Value = "mg/lt";
   


        this.dataGridView1.Rows[29].Cells[0].Value = "Nitritos";
      
        this.dataGridView1.Rows[29].Cells[1].Value = "kg/dia ";




        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);


        //Nitratos
        this.dataGridView1.Rows[30].Cells[0].Value = "Nitratos";
      
        this.dataGridView1.Rows[30].Cells[1].Value = "mg/lt";
      


        this.dataGridView1.Rows[31].Cells[0].Value = "Nitratos";

        this.dataGridView1.Rows[31].Cells[1].Value = "kg/dia ";



        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);



        //Huevos de Helminto
        this.dataGridView1.Rows[32].Cells[0].Value = "Huevos de Helminto";
       
        this.dataGridView1.Rows[32].Cells[1].Value = "mg/lt";
      


        this.dataGridView1.Rows[33].Cells[0].Value = "Huevos de Helminto";
      
        this.dataGridView1.Rows[33].Cells[1].Value = "kg/dia ";



        //1
        this.dataGridView1.Rows[i].Cells[2].Value = this.dataGridView2.Rows[7].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[2].Value);


        //2
        this.dataGridView1.Rows[i].Cells[3].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value);
        this.dataGridView1.Rows[j].Cells[3].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[3].Value);



        //4
        this.dataGridView1.Rows[i].Cells[5].Value = this.dataGridView2.Rows[5].Cells[2].Value;
        this.dataGridView1.Rows[j].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[5].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[5].Value);


        //5
        this.dataGridView1.Rows[i].Cells[6].Value = this.dataGridView1.Rows[i].Cells[5].Value;

        this.dataGridView1.Rows[j].Cells[6].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[6].Value);

        //6
        this.dataGridView1.Rows[i].Cells[7].Value = this.dataGridView1.Rows[i].Cells[3].Value;

        this.dataGridView1.Rows[j].Cells[7].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[7].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[7].Value);
        //7

        this.dataGridView1.Rows[i].Cells[8].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[6].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value);
        this.dataGridView1.Rows[j].Cells[8].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[8].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[8].Value);

        //9


        this.dataGridView1.Rows[i].Cells[10].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[10].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[10].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[10].Value);

        //10
        this.dataGridView1.Rows[i].Cells[11].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[11].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[11].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[11].Value);

        //11
        this.dataGridView1.Rows[i].Cells[12].Value = this.dataGridView1.Rows[i].Cells[5].Value;
        this.dataGridView1.Rows[j].Cells[12].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[12].Value);

        //12

        this.dataGridView1.Rows[i].Cells[13].Value = this.dataGridView1.Rows[i].Cells[8].Value;
        this.dataGridView1.Rows[j].Cells[13].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[13].Value);

        //13

        this.dataGridView1.Rows[i].Cells[14].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[12].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[13].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value);
        this.dataGridView1.Rows[j].Cells[14].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[14].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[14].Value);




        //15
        this.dataGridView1.Rows[i].Cells[16].Value = this.dataGridView1.Rows[i].Cells[14].Value;
        this.dataGridView1.Rows[j].Cells[16].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[16].Value);

        //16
        this.dataGridView1.Rows[i].Cells[17].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[17].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[17].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[17].Value);



        //17

        this.dataGridView1.Rows[i].Cells[18].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[18].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[18].Value);


        //18

        this.dataGridView1.Rows[i].Cells[19].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[19].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[19].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[19].Value);

        //19

        this.dataGridView1.Rows[i].Cells[20].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[16].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[18].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value);
        this.dataGridView1.Rows[j].Cells[20].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[20].Value);


        //20

        this.dataGridView1.Rows[i].Cells[21].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[j].Cells[21].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[21].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[21].Value);



        //21

        this.dataGridView1.Rows[i].Cells[22].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[22].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[22].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[22].Value);


        //22
        this.dataGridView1.Rows[i].Cells[23].Value = ((Convert.ToDouble(this.dataGridView1.Rows[i].Cells[20].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value)) + (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) * Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value))) / Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value);
        this.dataGridView1.Rows[j].Cells[23].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[23].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[23].Value);

        //23
        this.dataGridView1.Rows[i].Cells[24].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[24].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[24].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[24].Value);

        //24
        this.dataGridView1.Rows[i].Cells[25].Value = this.dataGridView1.Rows[i].Cells[23].Value;
        this.dataGridView1.Rows[j].Cells[25].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[25].Value);

        //25
        this.dataGridView1.Rows[i].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[i].Cells[25].Value) / (1 + Convert.ToDouble(this.dataGridView2.Rows[5].Cells[3].Value));
        this.dataGridView1.Rows[j].Cells[26].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[26].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[26].Value);

        //26

        this.dataGridView1.Rows[i].Cells[27].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[27].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[27].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[27].Value);

        //27
        this.dataGridView1.Rows[i].Cells[28].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[28].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[28].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[28].Value);

        //28
        this.dataGridView1.Rows[i].Cells[29].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[29].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[29].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[29].Value);

        //29
        this.dataGridView1.Rows[i].Cells[30].Value = this.dataGridView1.Rows[i].Cells[30].Value;
        this.dataGridView1.Rows[j].Cells[30].Value = (Convert.ToDouble(this.dataGridView1.Rows[i].Cells[30].Value) / 1000) * Convert.ToDouble(this.dataGridView1.Rows[1].Cells[30].Value);

      }

 

      private void button2_Click(object sender, EventArgs e)
      {

      }


      private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
      {

        //GASTO
        this.dataGridView1.Rows[0].Cells[0].Value = "Gasto";

        this.dataGridView1.Rows[0].Cells[1].Value = "l/s";


        this.dataGridView1.Rows[1].Cells[0].Value = "Gasto";

        this.dataGridView1.Rows[1].Cells[1].Value = "m3/dia";


        this.dataGridView1.Rows[0].Cells[2].Value = Convert.ToDouble(this.dataGridView2.Rows[0].Cells[2].Value);


        this.dataGridView1.Rows[1].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value) * 86400) / 1000;


        this.dataGridView1.Rows[0].Cells[17].Value = Lodos.Recirculacion1 * 0.05;
        this.dataGridView1.Rows[1].Cells[17].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value) * 86400 / 1000;


        this.dataGridView1.Rows[0].Cells[3].Value = Gasto.Gastomedio1 + double.Parse(this.dataGridView1.Rows[0].Cells[17].Value.ToString());
        this.dataGridView1.Rows[1].Cells[3].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value) * 86400 / 1000;


        this.dataGridView1.Rows[0].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[3].Cells[4].Value)) * 5 / 86400;

        this.dataGridView1.Rows[1].Cells[5].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[5].Value) * 86400 / 1000;


        this.dataGridView1.Rows[0].Cells[6].Value = this.dataGridView1.Rows[0].Cells[5].Value;
        this.dataGridView1.Rows[1].Cells[6].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[7].Value = this.dataGridView1.Rows[0].Cells[3].Value;
        this.dataGridView1.Rows[1].Cells[7].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[7].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[8].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[7].Value);
        this.dataGridView1.Rows[1].Cells[8].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[10].Value = Convert.ToDouble(this.dataGridView1.Rows[5].Cells[7].Value) * 50 / 86400;
        this.dataGridView1.Rows[1].Cells[10].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[10].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[11].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[10].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[5].Value);
        this.dataGridView1.Rows[1].Cells[11].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[11].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[12].Value = this.dataGridView1.Rows[0].Cells[10].Value;
        this.dataGridView1.Rows[1].Cells[12].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[13].Value = this.dataGridView1.Rows[0].Cells[8].Value;
        this.dataGridView1.Rows[1].Cells[13].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value) * 86400 / 1000;


        this.dataGridView1.Rows[0].Cells[14].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value);
        this.dataGridView1.Rows[1].Cells[14].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[16].Value = this.dataGridView1.Rows[0].Cells[14].Value;
        this.dataGridView1.Rows[1].Cells[16].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value) * 86400 / 1000;


        this.dataGridView1.Rows[0].Cells[17].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.05;
        this.dataGridView1.Rows[1].Cells[17].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value) * 86400 / 1000;


        this.dataGridView1.Rows[0].Cells[18].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.15;
        this.dataGridView1.Rows[1].Cells[18].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[19].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.2;
        this.dataGridView1.Rows[1].Cells[19].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[19].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[20].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value);
        this.dataGridView1.Rows[1].Cells[20].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value) * 86400 / 1000;


        this.dataGridView1.Rows[0].Cells[22].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.8;
        this.dataGridView1.Rows[1].Cells[22].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[23].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value) + Convert.ToDouble(this.dataGridView2.Rows[2].Cells[2].Value);
        this.dataGridView1.Rows[1].Cells[23].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[24].Value = 147.99 * 0.1;
        this.dataGridView1.Rows[1].Cells[24].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[25].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value) - Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value);
        this.dataGridView1.Rows[1].Cells[25].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[21].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value);
        this.dataGridView1.Rows[1].Cells[21].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
        this.dataGridView1.Rows[1].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[26].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[27].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value);
        this.dataGridView1.Rows[1].Cells[27].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[27].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[28].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[26].Value) - Convert.ToDouble(this.dataGridView1.Rows[0].Cells[27].Value);
        this.dataGridView1.Rows[1].Cells[28].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[28].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[29].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value);
        this.dataGridView1.Rows[1].Cells[29].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[29].Value) * 86400 / 1000;

        this.dataGridView1.Rows[0].Cells[30].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[28].Value) - Convert.ToDouble(this.dataGridView1.Rows[0].Cells[10].Value);
        this.dataGridView1.Rows[1].Cells[30].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[30].Value) * 86400 / 1000;
        
        
        
      }

    
    }
}
Peter Bromberg replied to Ismael on 20-Jul-11 09:31 PM
So, you just posted a whole bunch of code. At which line is the exception thrown?
Jitendra Faye replied to Ismael on 20-Jul-11 11:31 PM
The actual operation of your program is not affected by this; it's entirely a debugger thing.

Are you building an optimized build, or an unoptimized build? In general, it's not guaranteed that the debugger will always be able to obtain all the local variable values at any given breakpoint. An unoptimized build is more likely to give you all the values than an optimized build, though. If you're currently building "Release," try building "Debug."
pete rainbow replied to Ismael on 21-Jul-11 12:17 AM
so i believe your problem is that you are changing the value of a grid cell inside the handler of the grid cell changed

this in turn will cause another cell changed event to be raised and you'll be back in your handler method again

this will continue until the stack is overflowed

you can fix by spinning off the update into async begininvoke

you could also check that the column being affected isn't the one you are changing via the program

private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
    {

      //GASTO
      this.dataGridView1.Rows[0].Cells[0].Value = "Gasto";
Ismael replied to Jitendra Faye on 21-Jul-11 12:59 AM
Well when i run it in debug it says this:

+        $exception    {Cannot evaluate expression because the current thread is in a stack overflow state.}    System.Exception {System.StackOverflowException}
        this    Cannot obtain value of local or argument '<this>' as it is not available at this instruction pointer, possibly because it has been optimized away.    tphfinal.BalanceForm

when i run it without debug, it just crashes

and its true i have cell changing events inside a cell change events, but its necessary for my program



the line that causes the trouble is this:


          private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
      {
        try
        {
          //GASTO
          this.dataGridView1.Rows[0].Cells[0].Value = "Gasto";

          this.dataGridView1.Rows[0].Cells[1].Value = "l/s";


          this.dataGridView1.Rows[1].Cells[0].Value = "Gasto";

          this.dataGridView1.Rows[1].Cells[1].Value = "m3/dia";


          this.dataGridView1.Rows[0].Cells[2].Value = Convert.ToDouble(this.dataGridView2.Rows[0].Cells[2].Value);


          this.dataGridView1.Rows[1].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value) * 86400) / 1000;


          this.dataGridView1.Rows[0].Cells[17].Value = Lodos.Recirculacion1 * 0.05;
          this.dataGridView1.Rows[1].Cells[17].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value) * 86400 / 1000;


          this.dataGridView1.Rows[0].Cells[3].Value = Gasto.Gastomedio1 + double.Parse(this.dataGridView1.Rows[0].Cells[17].Value.ToString());
          this.dataGridView1.Rows[1].Cells[3].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value) * 86400 / 1000;


          this.dataGridView1.Rows[0].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[3].Cells[4].Value)) * 5 / 86400;

          this.dataGridView1.Rows[1].Cells[5].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[5].Value) * 86400 / 1000;


          this.dataGridView1.Rows[0].Cells[6].Value = this.dataGridView1.Rows[0].Cells[5].Value;
          this.dataGridView1.Rows[1].Cells[6].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[7].Value = this.dataGridView1.Rows[0].Cells[3].Value;
          this.dataGridView1.Rows[1].Cells[7].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[7].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[8].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[6].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[7].Value);
          this.dataGridView1.Rows[1].Cells[8].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[8].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[10].Value = Convert.ToDouble(this.dataGridView1.Rows[5].Cells[7].Value) * 50 / 86400;
          this.dataGridView1.Rows[1].Cells[10].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[10].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[11].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[10].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[5].Value);
          this.dataGridView1.Rows[1].Cells[11].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[11].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[12].Value = this.dataGridView1.Rows[0].Cells[10].Value;
          this.dataGridView1.Rows[1].Cells[12].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[13].Value = this.dataGridView1.Rows[0].Cells[8].Value;
          this.dataGridView1.Rows[1].Cells[13].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value) * 86400 / 1000;


          this.dataGridView1.Rows[0].Cells[14].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[12].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[13].Value);
          this.dataGridView1.Rows[1].Cells[14].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[14].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[16].Value = this.dataGridView1.Rows[0].Cells[14].Value;
          this.dataGridView1.Rows[1].Cells[16].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value) * 86400 / 1000;


          this.dataGridView1.Rows[0].Cells[17].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.05;
          this.dataGridView1.Rows[1].Cells[17].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value) * 86400 / 1000;


          this.dataGridView1.Rows[0].Cells[18].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.15;
          this.dataGridView1.Rows[1].Cells[18].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[19].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.2;
          this.dataGridView1.Rows[1].Cells[19].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[19].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[20].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[16].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[18].Value);
          this.dataGridView1.Rows[1].Cells[20].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value) * 86400 / 1000;


          this.dataGridView1.Rows[0].Cells[22].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value) * 0.8;
          this.dataGridView1.Rows[1].Cells[22].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[23].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[20].Value) + Convert.ToDouble(this.dataGridView2.Rows[2].Cells[2].Value);
          this.dataGridView1.Rows[1].Cells[23].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[24].Value = 147.99 * 0.1;
          this.dataGridView1.Rows[1].Cells[24].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[25].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[23].Value) - Convert.ToDouble(this.dataGridView1.Rows[0].Cells[24].Value);
          this.dataGridView1.Rows[1].Cells[25].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[21].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[22].Value) + Convert.ToDouble(this.dataGridView1.Rows[0].Cells[25].Value);
          this.dataGridView1.Rows[1].Cells[21].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[21].Value);
          this.dataGridView1.Rows[1].Cells[26].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[26].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[27].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value);
          this.dataGridView1.Rows[1].Cells[27].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[27].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[28].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[26].Value) - Convert.ToDouble(this.dataGridView1.Rows[0].Cells[27].Value);
          this.dataGridView1.Rows[1].Cells[28].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[28].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[29].Value = Convert.ToDouble(this.dataGridView2.Rows[1].Cells[2].Value);
          this.dataGridView1.Rows[1].Cells[29].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[29].Value) * 86400 / 1000;

          this.dataGridView1.Rows[0].Cells[30].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[28].Value) - Convert.ToDouble(this.dataGridView1.Rows[0].Cells[10].Value);
          this.dataGridView1.Rows[1].Cells[30].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[30].Value) * 86400 / 1000;

        }
        catch{
        }
        
      }