How can I edit a registry key with VB.NET or VB6? -


I have to edit a registry key and set the data value to "4"

I know how to do this via command prompt, but it is trying to find some visual basic code.

If this helps, then this key is:

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ USBSTOR \ Start

Here's how you do it in Visual Basic .NET

  RegistryKey = RegistryKey subkey = key.OpenSubKey ("System \ CurrentControlSet \ Services \ USBSTOR", true) subkey as Registry.LocalMachine Dim subkey. Set Value ("Start", 4)  

Be sure to add

  import system import on Microsoft.Win32  

to your Top.


Comments