c# - Registry CreateSubKey not working and no receiving error -


i did before , simple code. here code

private void button1_click(object sender, eventargs e) {     var k1 = registry.localmachine.opensubkey("software", true).createsubkey("test"); } 

im looking regedit hkey_local_machine-software , wow6432node. cant find test key in there.

my user administrator.

i didnt receive error.

maybe has easy solution im working 45 minutes , cant solve problem. thank helping.

are sure you're looking right thing? registry can fickle thing..

i ran

registrykey k1 = registry.localmachine.opensubkey("software", true).createsubkey("test"); k1.setvalue("my value","here"); 

nothing shows yet in regedit - somethings dont show because depends when read.

however ending app, , running

registrykey k1 = registry.localmachine.opensubkey("software", true).createsubkey("test"); console.writeline(k1.getvalue("my value")); 

shows value there.


Comments