Goran Bibic

Goran Bibic

  • 482
  • 2.9k
  • 197.9k

CELLS Value with 2 condition c#

Oct 7 2022 8:13 AM

I put two condition from two cells but don't wotk, please respond

First part condition work fine, when put && and other condition don't wotk

 if (row.Cells["Status"].Value.ToString() == "Otvoren" && row.Cells["RN"].Value.ToString() == null)

Line 6


private void OrdersDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            foreach (DataGridViewRow row in OrdersDataGridView.Rows)
            {
                if (row.Cells["Status"].Value.ToString() == "Otvoren" && row.Cells["RN"].Value.ToString() == null)
                {
                    row.DefaultCellStyle.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF5F1F");
                }
             
            }
        }

 


Answers (3)