Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Catch of a bad date?
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00932966
Message ID:
00933122
Views:
13
What do you mean that your catch does not seem to work? I tried this and it always catch the exception.
try 
{
	Convert.ToDateTime( "166.35.04"); 
}
catch(Exception e )
{
	Console.WriteLine( "Bad Date was attempted" );
}
>I'm trying to create a date textbox that will vaidate the date. I'm having a problem in my catch:
>
>try
>{
> Convert.ToDateTime( this.TextBox1.Text.ToString());
>}
>
>catch(Exception e )
>{
> this.Label1.Text="Bad Date was attempted";
>}
>
>My catch doesn't ever seem to work "166.35.04" is not a good date.
>
>Any ideas?
>
>TIA
>
>__Stephen
Hector Correa
Previous
Reply
Map
View

Click here to load this message in the networking platform