I am experiencing the same problem as described in thread796-1042121. I can run the program (a windows forms application which simply changes a registry value) through the Visual Studio IDE but as soon as I try and just execute the program (by running the .exe file through Windows explorer), it gives the error. Just fo reference, the code I am using is
Dan Griffiths
Software Analyst
National Grid plc
Code:
Imports Microsoft.win32
Module modStart
Public Sub Main()
Dim wallpaperKey As RegistryKey
Try
wallpaperKey = Registry.CurrentUser.OpenSubKey("Software", True).OpenSubKey("Microsoft", True).OpenSubKey("Windows", True).OpenSubKey("CurrentVersion", True).OpenSubKey("Policies", True).OpenSubKey("System", True)
wallpaperKey.SetValue("wallpaper", "c:\windows\bground.bmp")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End
End Try
End Sub
End Module
Dan Griffiths
Software Analyst
National Grid plc