Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

I know how to do it through the command prompt but am trying to find some Visual Basic code to do it.

If it helps, this is the key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Start

like image 816
user60220 Avatar asked Sep 02 '25 05:09

user60220


1 Answers

Here's how you can do it in Visual Basic 6 (or VBA)

Download this registry editing code and put it into a class.

Then you can have code like the following to actually modify the value:

Dim reg As New RegistryClass

With reg
    .SetKeyValue .HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Services\USBSTOR", .RegDWORD, "Start", 4
End With
like image 148
Mark Biek Avatar answered Sep 04 '25 21:09

Mark Biek