Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

c# winform If condition is meet = Good

$
0
0

I have a piece of code that it one cell is greater then another turn the cell red.

I am trying to change it to where if the condition is meet add text good to the cell and if not add Bad.

could someone give me a hand ?

Thanks

foreach (DataGridViewRow row in this.dataGridView1.Rows)
            {
                double value1;
                double value2;
                if (!double.TryParse(row.Cells[20].Value.ToString(), out value1) || !double.TryParse(row.Cells[6].Value.ToString(), out value2))
                {
                    // throw exception or other handling here for unexcepted values in cells
                }
                else if (value1 > value2)
                {
                    row.Cells[34].Style.BackColor = Color.Red;


Booney440


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>