Click to See Complete Forum and Search --> : CONTROL PANEL


Cyrus
September 13th, 2001, 12:59 AM
i have written a software that uses DATES and System Dates for calculation and printing formatted as dd/mm/yyyy which is being used for quites sometime, suddenly my programs starts giving wrong results on date calculation as well as in printing. I have discovered that one fkng happy trigger user changed the system date format to mm/dd/yyyy through control panel. Anybody have an idea to protect a software for such unknown changes in system settings.? Is there a way to limit the access of the control panel.?

thanks


cyrus

Cimperiali
September 13th, 2001, 01:51 AM
Have a look:
http://www.mvps.org/vbnet/code/locale/setlocaleinfo.htm

Do your best to have a nice day.

Cesare Imperiali

Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater

berta
September 13th, 2001, 01:55 AM
...the regional settings is a service of windows... if U develop in windows U must consider this service.
For a correct reading of a date U can use function as dateserial,month,year,weekday...

hi,brt

<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/images/bertaplanet.gif'>
</center>

Cimperiali
September 13th, 2001, 02:02 AM
Obtaining user regionalSettings:
http://www.mvps.org/vbnet/code/locale/localeenumdates.htm

Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater

bhagyesht
March 19th, 2002, 07:21 AM
'use the following code
'The declarations
private Declare Function GetSystemDefaultLCID Lib "kernel32" () as Long
private Const LOCALE_SSHORTDATE = &H1F ' short date format string
private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (byval Locale as Long, byval LCType as Long, byval lpLCData as string, byval cchData as Long) as Long
private Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" (byval Locale as Long, byval LCType as Long, byval lpLCData as string) as Long



' the function
private Sub Command1_Click()
Dim sReturn as string
Dim r as Long
Dim LCID as Long
LCID = GetSystemDefaultLCID()
r = GetLocaleInfo(LCID, LOCALE_SSHORTDATE, sReturn, len(sReturn))
If r then
'pad the buffer with spaces to create the size of memory buffer
sReturn = Space$(r)
'and call again passing the buffer
r = GetLocaleInfo(LCID, LOCALE_SSHORTDATE, sReturn, len(sReturn))
'if successful (r > 0)
If r then
'r holds the size of the string
'including the terminating null
If Left$(sReturn, r - 1) <> "dd/MM/yyyy" then
Call SetLocaleInfo(LCID, LOCALE_SSHORTDATE, "dd/MM/yyyy")
End If
End If
End If
End Sub

a.k.lakhman
March 25th, 2002, 10:42 PM
dear ,
1.set the data type of date column in table as text.
2.make use of mask edit control
3.use only one format say 02-04-2001 in mask edit control
4.manipulate date by using datevalue function

have a nice day
a.k.lakhman
--------------