Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Accessing the Registry

It’s easy to write to the registry with the My feature, but you need to be careful. Writing carelessly to the registry can make other applications run poorly, or even prevent the computer from starting correctly. Listing 5 dumps the CurrentUser keys—a read action that’s relatively safe.

Listing 5 Reading the subkeys for the current user.

Sub ReadRegistry()
 Dim keys() As String = My.Computer.Registry.LocalMachine.GetSubKeyNames()

 Dim key As String
 For Each key In keys

 Console.WriteLine("press enter")
End Sub

This code is self-explanatory. One word of caution, though: Before you start reading and writing the registry, run regedt32.exe and export your current registry settings.

  • + Share This
  • 🔖 Save To Your Account