Some times we saw the error in our code.Check the below solution to fix the simple bug.
CultureInfo :
It's Provides information about a specific culture.The information includes the names for the culture, the writing system, the calendar used, the sort order of strings, and formatting for dates and numbers.
- using System.Globalization;
-
-
- DateTime From = DateTime.ParseExact(txtFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);