Your code should be as following.
public bool IsCellOrRowHeader(int x, int y)
{
try
{
DataGridViewHitTestType dgt = dgv.HitTest(x, y).Type;
return (dgt == DataGridViewHitTestType.Cell ||
dgt == DataGridViewHitTestType.RowHeader);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Limit Viewer");
writeErrorlog("Limit Viewer ( IsCellOrRowHeader)", ex.Message, ex.StackTrace);
return false;
}
}
Your method return type is bool so all the code path should return a boolean value. In this case your catch block is returning void. So change the
return;
to
return false;