|
-
July 12th, 2007, 01:20 AM
#1
DateTime Checking
I have a datetime that must required user to key in textbox.Does anyone has idea on checking the datetime that user key in such as IsNumeric?
-
July 12th, 2007, 02:00 AM
#2
Re: DateTime Checking
Have you checked DateTime.TryParse() method? This method will check if the Datetime entered is a valid date/time or not.
-
July 12th, 2007, 03:33 AM
#3
Re: DateTime Checking
Got it ..this is what i do
Code:
Public Function IsDate(ByVal strDate As String) As Boolean
If strDate Is Nothing Then
strDate = ""
End If
If strDate.Length > 0 Then
Dim dteEmpty As Date = Nothing
Return DateTime.TryParse(strDate, dteEmpty)
Else
Return False
End If
Last edited by johnsonlim026; July 12th, 2007 at 03:36 AM.
-
July 12th, 2007, 11:46 PM
#4
Date And Time constraints in a textbox
Hi,
I have a textbox that required user to key in the date and time together.
I have try with DateTime.TryParse() method .It only return true if the text in the textbox is datetime.
But how if I want to enforce user to key in the date and time together in the textbox(For Example: 13/7/2007 08:00:59.000) .If user key in the date only or time only it will prompt out error message...
Does anyone idea on doing this?
-
July 13th, 2007, 01:55 AM
#5
Re: Date And Time constraints in a textbox
[Merged Threads]
John,
As you already have the similar kind of thread, I have merged them. You can ask questions related to the same issue here also.
Instead of using DateTime.TryParse, use DateTime.TryParseExact.
-
July 13th, 2007, 11:40 AM
#6
Re: Date And Time constraints in a textbox
You can also use MaskedTextBox control.
-
July 13th, 2007, 10:37 PM
#7
Re: Date And Time constraints in a textbox
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|