Wrox Programmer Forums
|
C# 4.0 aka C# 2010 General Discussion Discussions about the C# 4.0, C# 4, Visual C# 2010 language and tool not related to any specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 4.0 aka C# 2010 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 14th, 2012, 06:22 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 2
Thanked 2 Times in 2 Posts
Default Check is a Textbox text is a valid date

Hello all,
how can I check if the Textbox text is a valid date without using an ASP.NET validator, but only plain C#?

Thanks in advance.

Luigi
 
Old March 16th, 2012, 11:18 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

There is a IsDate function in VB.NET. Since you are using C# you need to use DateTime.TryParse and get the output

Cheers
shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old May 1st, 2014, 04:13 PM
Friend of Wrox
 
Join Date: Feb 2014
Posts: 136
Thanks: 1
Thanked 10 Times in 10 Posts
Default

the compare validator has a Data type check and a type to compare against set to DateTime





Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter as a valid entry in a textbox (VB) Grimgore BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8 2 February 9th, 2009 04:37 PM
How to check if a textbox has focus using c#? Hannibal ASP.NET 2.0 Basics 0 May 15th, 2007 01:02 AM
How to check for a valid session? deb1980 ASP.NET 2.0 Basics 8 March 24th, 2007 06:27 PM
check value of a textbox. kareltje Access VBA 1 May 10th, 2005 01:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.