Visual Basic Development Bookmark and Share   
 Home > Visual Basic Interop and Upgrade > IsDate function migration issue
 

IsDate function migration issue

Our application was recently migrated from VB 6.0 to VB .NET. I am having an issue with the IsDate function working differently in .NET. I found references that indicate that there is a IsDate6 function that works the same as the VB 6 function. I would appreciate it if someone could tell me where to find this function or what should replace it?
J Maynard  Friday, November 13, 2009 8:09 PM
Riquel is correct. In VB 6.0 the IsDate function will return True for "3.24". The IsDate function in VB 6.0 has reliability issues with respect to two-digit yearsand will return True if the date matches any regional setting.

If I remember correctly the IsDate function inVB .NET calls the DateTime.Parse method.
Paul ~~~~ Microsoft MVP (Visual Basic)
Paul P Clement IV  Wednesday, November 18, 2009 7:47 PM
Hi J Maynard,

You can directly use IsDate function in VB.NET application.
http://msdn.microsoft.com/en-us/library/00wf8zk9(VS.71).aspx

You can read Visual Basic .NET Internals for other methods for your use:
http://msdn.microsoft.com/en-us/library/aa289509(VS.71).aspx
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Riquel_Dong  Tuesday, November 17, 2009 10:11 AM
Hi Riquel

Our application is currently using the IsDate function - however, it is not working as it did when the application was written in VB 6. I won't go into why (basically I inherited this part and don't know why), when data is read in from the database it is going through an universal function which will format the data if it determines it is a date. We have an occurrence where a percentage is going through this routine. In the new .NET version of the code IsDate ("3.24") is returning a true file and the percentage is getting changed to Dec 30, 1988 03:24:00. In the VB 6 version of the code IsDate ("3.24") returned a false value.

I need the IsDate to return a false when "3.24" is passed to it like it used to.

Hope this helps explain the issue.

Thanks again for any help.

Jim
J Maynard  Tuesday, November 17, 2009 3:16 PM
Hi Jim,

Please let me know how you get IsDate("3.24") to return false. In VB6 I got True value in MsgBox.

Private Sub Command1_Click()
MsgBox IsDate("3.24")
End Sub
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Riquel_Dong  Wednesday, November 18, 2009 7:53 AM
Riquel is correct. In VB 6.0 the IsDate function will return True for "3.24". The IsDate function in VB 6.0 has reliability issues with respect to two-digit yearsand will return True if the date matches any regional setting.

If I remember correctly the IsDate function inVB .NET calls the DateTime.Parse method.
Paul ~~~~ Microsoft MVP (Visual Basic)
Paul P Clement IV  Wednesday, November 18, 2009 7:47 PM

You can use google to search for other answers

Custom Search

More Threads

• VB6.FORMAT and "trust" levels...
• Error Creating Interop Form Wrapper Classes for Project ...
• Debugger Not Allowing Me To Trap Errors.
• Difference ComClass & InteropServices
• Refence Book reccomendations?
• Can I use .net Dll into vb6.0
• Create Interop UserControl in InteropForm Library Project?
• Question regarding interfaces and stuff in GRAPH OBJECT LIBRARY particularly those in OFFICE 11 or OFFICE 12.
• Making a phone call using TAPI3Lib
• Welcome dialog for first time user of Microsoft Project 2007 causes problem with automation.