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");
}
}
}
Rajanikant HawaldarPosted Oct 7, 2022, 9:09 AM
Rajanikant HawaldarPosted Oct 7, 2022, 9:11 AM
@Uday, if Value is null ToString() will through runtime exception
Uday DodiyaPosted Oct 7, 2022, 9:07 AM
You can try IsNullOrEmpty function to check empty or Null Values in string