Microsoft.Win32.RegistryKey.SetValue C# (CSharp) Méthode

SetValue() public méthode

public SetValue ( string name, object value ) : void
name string
value object
Résultat void
        public void SetValue(string name, object value) { }
        public void SetValue(string name, object value, Microsoft.Win32.RegistryValueKind valueKind) { }

Same methods

RegistryKey::SetValue ( string name, object value, Microsoft valueKind ) : void

Usage Example

        public bool RegistIt(string realCode)
        {
            try
            {
                if (realCode != "")
                {
                    Microsoft.Win32.RegistryKey retkey =
                        Microsoft.Win32.Registry.CurrentUser.
                        OpenSubKey("software", true).CreateSubKey("umehd").
                        CreateSubKey("register.ini");
                    retkey.SetValue("register", realCode.TrimEnd());

                    retkey = Microsoft.Win32.Registry.LocalMachine.
                             OpenSubKey("software", true).CreateSubKey("umehd").
                             CreateSubKey("register.ini");
                    retkey.SetValue("register", realCode.TrimEnd());

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }
            return(false);
        }
All Usage Examples Of Microsoft.Win32.RegistryKey::SetValue