The simple way is to check at the top of your method:
if (string.IsNullOrWhitespace(txt_SearchDateFrom.Text) || string.IsNullOrWhitespace(txt_SearchDateTo.Text))
{
MessageBox.Show("Please enter a form and a to date");
return;
}
But that doesn't stop them entering rubbish. I would use that, plus I would use TryParse:
if (DateTime.TryParse(txt_SearchDateFrom.Text, out objdal2.DateFrom) &&
DateTime.TryParse(txt_SearchDateTo.Text, out objdal2.DateTo))
{
...
}
But my preference would be to prevent both problems altogether by not using TextBoxes at all! Have you considered a DateTimePicker instead? That way, the user can't enter an invalid date, and you don't have to do any conversion.