This documentation is archived and is not being maintained.

My.Computer.Registry.SetValue Method 

Writes a value to a registry key.


' Usage
My.Computer.Registry.SetValue(keyName ,valueName ,value)
My.Computer.Registry.SetValue(keyName ,valueName ,value ,valueKind)
' Declaration
Public Sub SetValue( _
   ByVal keyName As String, _
   ByVal valueName As String, _
   ByVal value As Object _
)
' -or-
Public Sub SetValue( _
   ByVal keyName As String, _
   ByVal valueName As String, _
   ByVal value As Object, _
   ByVal valueKind As Microsoft.Win32.RegistryValueKind _
)

Parameters

keyName

String. Name of the key to be written to. Required.

valueName

String. Name of the value to be written. Required.

value

Object. Value to be written. Required.

valueKind

RegistryValueKind. Required.

If the specified key or value does not exist, it is created.

The following conditions may cause an exception:

Here is an example of a task involving the My.Computer.Registry.SetValue method.

This example sets the value Name to "Author's Name" in the key HKEY_CURRENT_USER\Software\MyApp.

Dim readValue As Object
readValue = My.Computer.Registry.GetValue _
("HKEY_CURRENT_USER\Software\MyApp", "Name", Nothing)

Namespace: Microsoft.VisualBasic.MyServices

Class: RegistryProxy (provides access to Registry)

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

No permissions are required.

Show: