Important alert: (current site time 7/16/2013 4:10:38 AM EDT)
 

VB icon

Y2K Test for VB5 and 6

Email
Submitted on: 5/14/1999
By: Preston Smith  
Level: Not Given
User Rating: By 102 Users
Compatibility: VB 5.0, VB 6.0
Views: 19710
 
     This program test the Visual Basic program you are currently running. As you will see.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: Y2K Test for VB5 and 6
' Description:This program test the Visual Basic program you are currently running. As you will see.
' By: Preston Smith
'
' Assumes:You can adjust the dates for Jan 1st 1930, Jan 1st 2029, Jan 1st 00 and Feb 29 or 30 2000. To see if your version is compliant then you should use 1/1/00 for the year 2000, and 2/29/00 for the Leap Year date (this will cause a run-time error, if NOT compliant). I made a big mistake before, the date regarding the leap year, should not cause a run time error if it is compliant.
'
' Side Effects:If you set up the code to check for the leap year date you should have a run-time error. If you do NOT have an error that is good. If you actually see a date then your version of VB is not compliant with Y2K. The updates and patches may be available at microsoft's MSDN websight. Problems? Get the SP3 updates, Go here (VB6): http://msdn.microsoft.com/vstudio/sp/default.asp Go here (VB5): http://msdn.microsoft.com/vstudio/sp/vs97/default.asp
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=1776&lngWId=1'for details.'**************************************

Sub Form_Load()
Dim MyDate as Date
MyDate = "1/1/00" 'Or
'MyDate = "1/1/29" 'Returns 1/1/2029
'MyDate = "1/1/30" 'Returns 1/1/1930
'MyDate = "2/29/00" 'The Leap Year Date (Usually causes the most probs) 
MsgBox Format(MyDate, "mm/dd/yyyy")
End Sub


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

5/14/1999 12:05:00 PMCraig

Is the runtime error because there never is a Feb. 30th? Should be Feb. 29th on a leap year?
(If this comment was disrespectful, please report it.)

 
5/19/1999 10:31:00 PMARRiVE

Yes That is the compiler catching it at runtime depending on prefs. Or it is a type mismatch on run time. the 29th is a leap a year! no wonder we have so many Y 2 K issues =\
(If this comment was disrespectful, please report it.)

 
5/20/1999 12:33:00 PMPreston Smith

Ooops. The date should be 2/29/00 to test for the leap year. I will fix that. The error is a Type Mismatch regardless of the date. Either way, if there is know error, then there is something wrong with VB. Otherwise, if you get the Mismatch error, then there is nothing wrong with the code.
(If this comment was disrespectful, please report it.)

 
6/9/1999 7:18:00 PMJargalsaikhan.B

Thanks for your free source!
(If this comment was disrespectful, please report it.)

 
6/9/1999 9:33:00 PMJean

Good job Preston looks like you'll be helping me next year!
(If this comment was disrespectful, please report it.)

 
6/10/1999 8:30:00 AMed

The year 2000 is a leap year so there should be no error when running the last test
(If this comment was disrespectful, please report it.)

 
6/11/1999 12:19:00 AMRob

Well i have VS6.0 SP3 and i get no error, am i missing something here?
hehe thanx

(If this comment was disrespectful, please report it.)

 
6/20/1999 3:59:00 PMBill

I have the same problem as Rob, but i'm using VB 5.0
(If this comment was disrespectful, please report it.)

 
6/20/1999 4:09:00 PMDrunk_Cowboy

Im running VB5 what can you do to fix your VB if you don't get an error ?
(If this comment was disrespectful, please report it.)

 
6/25/1999 3:05:00 AMDSN

Basic, but Good
(If this comment was disrespectful, please report it.)

 
7/6/1999 5:39:00 PMBill

To fix VB you would have to get into the source code of VB and fix it. That means you can't fix it.
(If this comment was disrespectful, please report it.)

 
7/6/1999 9:50:00 PMPreston

From what I read at MSDN online, the Y2K problem can be repaired by installing the SP3 Updates. Of course, this is Microsoft were talking about. I had an error with VB6.0. I don't have the mismatch error anymore after installing the patch.
(If this comment was disrespectful, please report it.)

 
7/9/1999 7:42:00 PMBeth Develos

Thanks for the code...

(If this comment was disrespectful, please report it.)

 
8/1/1999 6:57:00 PMDan

We Have an old (not updated) version of VB5 but we updated Win 98 with Y2K Fix
No problem with any of your code including my own little addition:
MsgBox Format(MyDate + 1, "mm/dd/yyyy")
on the leap year that shows the correct 03/01/2000 date.

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.