C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

How to validate date?


Posted Date: 12 Apr 2004    Resource Type: Articles    Category: .NET Framework
Author: ManojRajanMember Level: Gold    
Rating: 1 out of 5Points: 7



One of the easiest way of validating the date is to assign the date to a date type variable, if it throws an exception then it is not in proper format.

Private Sub CheckDate(ByVal d As String, ByVal m As String, ByVal y As String)
Try
Dim mydate As Date
mydate = New DateTime(y, m, d)
Catch obj As Exception
MessageBox.Show ( obj.Message )
End Try
End Sub


Now call this function

CheckDate("2", "12", "2004")



Responses

Author: Asad Naeem    03 Jul 2004Member Level: Bronze   Points : 0
Very simple code to help beginners for the validation of date.


Author: Ashokselva    31 Aug 2004Member Level: Bronze   Points : 0
sir i copied this same code and work it out in vb.net.but there is no change at all .i dont know what happened?


Author: Ashokselva    31 Aug 2004Member Level: Bronze   Points : 0
sir i copied this same code and work it out in vb.net.but there is no change at all .i dont know what happened?


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Operations that can be performed on POINTER'S
Previous Resource: Persisting Application data using Hashtable and IsolatedStorage
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use