I Want it to be able to accept having null as a return value but I keep getting nullexception errors when pulling the non-existent data... Yes I understand how that sounds.
Basically, if the data is not found in a certain column, then create a row.
Getting the null error where clause because it cannot find value.... How do I get past this problem and allow "where" to not give error at its line?
var row = RGV.Rows.Cast<DataGridViewRow>()
.Where(r => r.Cells["firstcolumn"].Value.ToString() == please)
.First();
if (row != null)
{
rowIndex = row.Index;
RGV.Rows[rowIndex].Cells[secondcolumn].Value = help;
RGV.Refresh();
}
else
{
RGV.Rows.Add();
int indexNew = RGV.Rows.Count;
RGV.Rows[indexNew].Cells["firstcolumn"].Value = please;
RGV.Rows[indexNew].Cells["secondcolumn"].Value = help;
RGV.Refresh();
}