Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

does Registry.CurrentUser.OpenSubKey create the key if it does not exist?

// No it does not - create it manually on null check
public void ConfigureWindowsRegistry()
{
    RegistryKey localMachine = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64); //here you specify where exactly you want your entry

   var reg = localMachine.OpenSubKey("SoftwareMicrosoftOfficeOutlookFormRegions	esssst",true);
   if (reg == null)
   {
       reg = localMachine.CreateSubKey("SoftwareMicrosoftOfficeOutlookFormRegions	esssst");
   }

   if (reg.GetValue("someKey") == null)
   {
       reg.SetValue("someKey", "someValue");
   }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: telerik mvc grid required field 
Csharp :: xamarin forms set the grid row property of an element programmatically 
Csharp :: unity follow object 
Csharp :: Propertychanged is not firing up when text is change 
Csharp :: c# text editor 
Csharp :: .net return context.Result without extra new objectResult 
Csharp :: start wpf application when windows start 
Csharp :: export xml 
Csharp :: internet connection sharing 
Csharp :: localhost ssl certificate error in visual studio 2022 .net 6 
Csharp :: convert list of object linq 
Csharp :: c# class reference 
Csharp :: json string to JObject object c# camelCasing key .net 
Csharp :: asp.net mvc table array binding arbitrary indices 
Csharp :: c# methods 
Csharp :: Get mac address of Device - NAYCode.com 
Csharp :: aquarette 
Csharp :: windows forms picturebox click event 
Csharp :: Mirror Inverse Program in c# 
Csharp :: c# file watcher specific file 
Csharp :: postgres .net 6 datetime issue 
Csharp :: c# bitwise or 
Csharp :: c# how to divide a list every 4 count 
Csharp :: prime number generator 
Csharp :: call ienumerator unity 
Csharp :: unity c# flip sprite 
Csharp :: transform face player unity 
Csharp :: convert uk string date to DateTime c# 
Csharp :: use different database with entitymanagerfactory 
Html :: opem link in new tab html 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =