I am making one application in which I need to enter the start and stop time in textbox. I have used masked text box. I want to check that Stop time should be greater than Start time and also the time entered should be in valid time format other-wise error message should be displayed.
You pass the method the string you wish to convert and assign an out parameter of type DateTime where you want the result to be stored. The method will store the converted value in the out parameter if it is successful.
The method itself returns a boolean to indicate success or failure, hence you can palce it in an if statement. The above says "if TryParse fails, do something" (notice the '!' not symbol before DateTime.TryParse).
Hope this gets you moving in the right direction. Have a go and psot if you get stuck.