0

I have attached one code of my project and i need a help in that.
The code is running without any error but i am stuck up in modifying that how to make a statement, of invalid format of date or time if the user enters the wrong format should i use Try Catch blocks or simply use the if else statement
I need to make it quite simple.

4
Contributors
3
Replies
13
Views
4 Years
Discussion Span
Last Post by Fenrir()
0

If you r using winforms, why don't you use the datetimepicker control?
WPF DatePicker Control??

Edited by grarhakim

0

Hi, sam wage, welcome here at DaniWeb.
I'm in with grarhakim here. If you can avoid it, don't annoy users with error messages and exceptions, just because the poor user typed something wrong in a date.

Edited by ddanbe: addition

0

You could use the TryParseExact method explained here Click Here

The easiest solution would however be just using the dateTimePicker as mentioned by grarhakim.

Edited by Fenrir()

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.