c# - If the Textbox is null this code returns date 1-1-0001 ... I want it to return null or empty string so what can I do? -


datetime fromdate; datetime.tryparseexact(fromdatetextbox.text, "dd/mm/yyyy", null, system.globalization.datetimestyles.none, out fromdate); 

check return values of tryparseexact

bool res = datetime.tryparseexact(fromdatetextbox.text, "dd/mm/yyyy", null, system.globalization.datetimestyles.none, out fromdate); if (res == false) {     //date not parsable... } 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -