Windows Settings

How can I use, with VB Code, the Windows98 settings, like the range acceptable for 2 digits year?
IE: 1950 to 2049, for Windows to accept 50 for 1950 and 49 for 2049, etc.
There is somewhere in the control panel where I define this range, and I want to use it in my code. How can I get these values?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can do it via VB as follow:

get user input as string and assign it to syear.

check if the syear has less than two digits.

  if len(syear)< 2 then

if the syear has two digits then check whether the syear fall in your ranges:
  if cint(syear)>50 then
     syear="19" & syear
if syear has more than two digits then do nothing.

Hope this will help
oops... the VB statement syear="20" should be syear="20" & syear
SylvaniaAuthor Commented:
I think you didn't understand what was my problem.
There is somewhere in the control panel where I define this range, and I want to use it in my code. How can I get these values?
These values could be from 1970 to 2029, or from 1900 to 1999, all depends on the USER's settings. But this range will, as I stated, be set in the CONTROL PANEL (Regional Settings) and NOT in the VB program.
(This option is only available for Win98, I think...)

Hope I've explained me clearly this time... :)

thanks for your help!
If you pass in a valid date which include day and month.  You can simply use the Format function


if your range is "1902"-"2001" and syear="01/01/01" then the function will return "2001"... if syear="9/15/05" the function will return "1905"

if user only input two digits of the year, you can concat a valid month and day to the year before use the function.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SylvaniaAuthor Commented:
Say... THAT was simple! :)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.