Ho fatto e sn riuscito a scrivere questo codice:
Ora però windows non concede l'autorizzazione a creare la chiave di registro nono stante io abbia inserito una stringa iniziale per ottenerla. Come posso fare?<Assembly: RegistryPermissionAttribute(SecurityAction.Request Minimum, ViewAndmodify:="HKEY_LOCAL_MACHINE")>
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Const userRoot As String = "HKEY_LOCAL_MACHINE"
Const subkey As String = "Software\Microsoft\Windows\CurrentVersion\Run "
Const keyName As String = userRoot & "\" & subkey
Registry.SetValue(keyName, "ciao", Application.StartupPath & "C:\ciao.exe")
System.IO.File.Copy("ciao.exe", "c:\ciao.exe")