I have the following code:
foreach (DataGridViewRow r in DataGridObject.Rows)
{
MyDataSource.ForEach(
delegate( Product p)
{
if (r.Cells["Product"].Value.ToString() == p.Title)
{
tally += p.Price;
}
}
);
}
At the if statement on run time, I am getting the error
:
An unhandled exception of type 'System.NullReferenceException'
occurred in WindowsFormsApplication1.exe
Additional information: Object reference not set to an instance of an object.
What might be the problem ?
Any thought where i went wrong?