Sinisterly
[VB.NET]How to compare two registry values? - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework)
+--- Thread: [VB.NET]How to compare two registry values? (/Thread-VB-NET-How-to-compare-two-registry-values)



[VB.NET]How to compare two registry values? - DonCorleone - 05-05-2011

Hi,
How to compare two registry values ​​so that if the value is 0, for example, display the order is enabled and if it shows that 2 is disabled.


RE: [VB.NET]How to compare two registry values? - 1234hotmaster - 05-05-2011

i don't really get what you mean. can you tell us what application your making?



RE: [VB.NET]How to compare two registry values? - DonCorleone - 05-05-2011

Code:
Dim key As RegistryKey = Registry.CurrentUser Dim subkey As RegistryKey subkey = key.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", True) subkey.SetValue("DisableRegistryTools", 0) Interaction.MsgBox("Edytor Rejestru został włączony :)", MsgBoxStyle.OkOnly, Nothing)
If this value DisableRegistryTools = 0, in order to display the registry editor is enabled and sory for my bad english


RE: [VB.NET]How to compare two registry values? - 1234hotmaster - 05-05-2011

Code:
Dim key As Microsoft.Win32.RegistryKey = Registry.CurrentUser Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", True) Dim Enabled As Byte = subkey.GetValue("DisableRegistryTools") If Enabled = 0 Then MsgBox("Registry is not Disabled!", MsgBoxStyle.Information) Else MsgBox("Registry is Disabled!", MsgBoxStyle.Information) End If

is this what you meant? Smile


RE: [VB.NET]How to compare two registry values? - DonCorleone - 05-05-2011

something
Code:
Dim key As Microsoft.Win32.RegistryKey = Registry.CurrentUser Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", True) Dim Enabled As Byte = subkey.GetValue("DisableRegistryTools") If Enabled = 0 Then Label11.Text = "Registry is not Disabled" Else Label11.Text = "Registry is Disabled!" End If
just to program check it before pressing the button or checkbox


RE: [VB.NET]How to compare two registry values? - 1234hotmaster - 05-05-2011

(05-05-2011, 10:23 AM)DonCorleone Wrote: something
Code:
Dim key As Microsoft.Win32.RegistryKey = Registry.CurrentUser Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", True) Dim Enabled As Byte = subkey.GetValue("DisableRegistryTools") If Enabled = 0 Then Label11.Text = "Registry is not Disabled" Else Label11.Text = "Registry is Disabled!" End If
just to program check it before pressing the button or checkbox

Nie rozumiem o co Ci chodzi dokładnie, ale myślę, że chcesz sprawdzić, czy zegar rejestru jest włączony, czy nie. jeżeli niepełnosprawnych przycisk można kliknąć, bo nie można kliknąć przycisk. mam rację, i?

www.translate.google.com 'What can i say when people can't speak english Tongue


RE: [VB.NET]How to compare two registry values? - DonCorleone - 05-05-2011

I want a program that verifies whether the option is enabled or not



RE: [VB.NET]How to compare two registry values? - Coder-san - 05-05-2011

That's what hotmaster posted above.

Code:
If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools", 0) = "0" Then Label1.Text = "Disabled" Else Label1.Text = "Enabled" End If

You get String Values as String, and DWORD values as Double, from the Registry. Just compare them like you are comparing a TextBox.