Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 4.0 aka C# 2010 > C# 4.0 aka C# 2010 General Discussion
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 14th, 2012, 06:22 AM
Authorized User
Points: 180, Level: 3
Points: 180, Level: 3 Points: 180, Level: 3 Points: 180, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2007
Location: Milan, , Italy.
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
  #2 (permalink)  
Old March 16th, 2012, 11:18 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
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)
  #3 (permalink)  
Old May 1st, 2014, 04:13 PM
Friend of Wrox
Points: 528, Level: 8
Points: 528, Level: 8 Points: 528, Level: 8 Points: 528, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 03: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



All times are GMT -4. The time now is 08:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.