❔ Doing a test DWORD, but sometimes the Dword value doesnt change:
I want to change the DWORD value when clicking the button, but it doesn't change. How do i resolve this issue?
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\AMD", "what", 1, RegistryValueKind.DWord);
33 Replies
I'm gonna assume "what" is not a real name lol
it isnt. it is just a test
You should provide more details
when i click a button, it should set the value what to 1, but it doesnt work.
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\AMD", "what", 1, RegistryValueKind.DWord);
code is here
Great, thanks. You just posted the exact same thing as in the original message
That really helped get more detail
wdym, i explained what the button should do, but it doesnt work
What does "doesn't work", mean
it doesnt change
the value
From what, how are you checking this
Are you getting an error
How are you testing this
nope no errors
What kind of project is this
What does the surrounding code look like
Is there anything else disrupting it
Like man
any more detail would be good
public partial class testform : Form
{
public testform()
{
InitializeComponent();
}
private void Apply_Click(object sender, EventArgs e)
{
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\AMD", "what", 1, RegistryValueKind.DWord); } } } this is my test code, yet the value doesnt change when clicked
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\AMD", "what", 1, RegistryValueKind.DWord); } } } this is my test code, yet the value doesnt change when clicked
.
.
using registry editor to see if the value changes
the output is clean, no errors
Are you testing your app with elevated rights
yes, i have it run as an administrator
Why are you using Registry.SetVakue instead of Registry.LocalMachine.SetValue
oh
it gives an error
Then look up how to fix it
alr
i have got a new line
try
{
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\AMD", "what", 1, RegistryValueKind.DWord);
Console.WriteLine("Registry value changed successfully.");
}
catch (Exception ex)
{
Console.WriteLine("An error occurred while changing the registry value: " + ex.Message);
}
the value doesnt change to 1 still
Oh, you made a new thread for the same thing 😕
btw, did you ever verify that your code is actually getting hit?
yeah, i put a message box to show that it works, but the value doesnt change, but the message box will say that the registry has been applied
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.not resolve yet
works fine for me btw
literally this is my entire program
and it works
I have no idea why the value for mine doesn’t change
oh wait
I might know
@2yxle print out
System.Environment.Is64BitProcess
and System.Environment.Is64BitOperatingSystem
Alr thx, I’ll try it out later
if your app is running as 32-bit, it might be hitting WOW64 redirection
in the proejct settings make sure "32-bit preferred" is not checked
Thank you
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.