String was not Recognized as a Valid Datetime

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. 
  1. using System.Globalization;//namespace  
  2.   
  3.   
  4. DateTime From = DateTime.ParseExact(txtFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);