"Automatically adjust clock for daylight saving changes"

T

Thorsten Doerfler

BobAchgill said:
Is there a way to know if this is set to true on the Windows Time Zone tab?

Through the registry:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

Value: DisableAutoDaylightTimeSet

A value of 1 means the setting is disabled otherwise the value didn't
exist or is 0.

Thorsten Doerfler
 
B

BobAchgill

I tried this see below but got this Error
Unhandled Win32 Exception


Imports System
Imports Microsoft.Win32

Put this in the Form1_Load...

MsgBox("DisableAutoDaylightTimeSet = " +
Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Control\TimeZoneInformation").GetValue("DisableAutoDaylightTimeSet"))
 
T

Thorsten Doerfler

BobAchgill said:
I tried this see below but got this Error
Unhandled Win32 Exception


Imports System
Imports Microsoft.Win32

Put this in the Form1_Load...

MsgBox("DisableAutoDaylightTimeSet = " +
Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Control\TimeZoneInformation").GetValue("DisableAutoDaylightTimeSet"))

WFM. WinXP SP2. .NET 2.0 SP1

Thorsten Doerfler
 
B

BobAchgill

Thorsten,

So you are saying that my syntax was exactly correct but I need to these
prerequisites ...???

WFM. WinXP SP2. .NET 2.0 SP1

What is WFM??

Thanks!

Bob
 
T

Thorsten Doerfler

BobAchgill said:
So you are saying that my syntax was exactly correct but I need to these
prerequisites ...???

The syntax is correct and doesn't cause an Win32 Exception here. I
would not say that the code will only working on WinXP SP2, it was the
only system I tried that. Maybe it would be easier, if you tell us,
what is your system configuration, where you get the Exception.

Normally the code shouldn't throw an Win32 Exception, only an
NullReference Exception, when the Value didn't exists. Maybe better,
if you use a default value:

MsgBox("DisableAutoDaylightTimeSet = " &
Registry.LocalMachine.OpenSubKey( _
"SYSTEM\CurrentControlSet\Control\TimeZoneInformation" _
).GetValue("DisableAutoDaylightTimeSet", 0).ToString)
WFM.

What is WFM??

Works for me.

Thorsten Doerfler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top