| Write/Read registry value .NET |
|
|
|
| Tutorials | |||
|
Code below shows how to write and read values to and from the registry. [code] Public Sub Writevalue()
'*************************************
'**** Code from VisibleVisual.com ****
'*************************************
Dim regKey As RegistryKey
Dim keyTop As RegistryKey = Registry.CurrentUser
regKey = keyTop.OpenSubKey("Software\MyCompany\MyApp", True)
If regKey Is Nothing Then
regKey = keyTop.CreateSubKey("Software\MyCompany\MyApp")
End If
Dim binValue As Byte() = {&HF0, &HFF, &H12, &HE0, &H43, &HAC}
Dim strngValue As String() = {"A", "B", "C", "D"}
regKey.SetValue("WindowState", 0, RegistryValueKind.DWord)
regKey.SetValue("CustomWindowCaption", "Client Contact Management", RegistryValueKind.String)
'regKey.SetValue("CustomPosition", binValue, RegistryValueKind.Binary)
'regKey.SetValue("CustomLabels", strngValue, RegistryValueKind.MultiString)
Public Sub ReadValue()
MsgBox (My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\MyCompany\MyApp\", "CustomWindowCaption", "0"))
End Sub
[/code]
|



Comments
RSS feed for comments to this post