How can I compare 2 data from a datagridview

0

Hello friends, I'm trying to compare a grid record, 2 values.

 DataGridViewRow row = dgvList.Rows[idx];

            if (row.Cells[3].Value.Equals(row.Cells[5].Value.ToString())) {
                var alta = Application.OpenForms.OfType<AltaEnInventario>().Single();
                alta.CerrarAlta();
            }

to call a function but it never enters .. the values that are found when debugging, are

 2.00 y 2.00

I'm trying to perform a function, that when the data of index 3 is equal to 5, it calls a method that I have. but never enters

but never enters the control statement. Any other suggestions?

    
asked by JuanL 15.07.2018 в 21:31
source

1 answer

1

What happens is that you bring it as ToString() and the first one, then you are never compatible, it should be like this:

DataGridViewRow row = dgvList.Rows [idx];

        if (row.Cells[3].Value.ToString().Equals(row.Cells[5].Value.ToString())) {
            var alta = Application.OpenForms.OfType<AltaEnInventario>().Single();
            alta.CerrarAlta();
        }

I hope you serve friend and the marques, By: JJ

    
answered by 15.07.2018 / 21:34
source