[VB.NET]Registre Windows

Résolu
shadow1779 Messages postés 706 Date d'inscription mercredi 17 novembre 2004 Statut Membre Dernière intervention 29 septembre 2013 - 12 mars 2006 à 12:05
 Utilisateur anonyme - 12 mars 2006 à 12:42
Bonjour,

j'ai un petit probleme dans un code, qui devrai verifier si une valeur est présente dans le registre ou non, sauf que meme si la valeur est présente cela ne coche pas la checkbox nommée checkreg
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim regkey As Microsoft.Win32.RegistryKey
Dim apppath As String
apppath = My.Computer.FileSystem.CurrentDirectory & "\ControlClipBoard.exe"
regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)

If Microsoft.Win32.Registry.LocalMachine.GetValue("ControlClipboard") Is Nothing Then
CheckReg.Checked = False
Else
CheckReg.Checked = True
End If
Dim myThread As New Thread(AddressOf ChargerDonnees)
myThread.Start()

End Sub

2 réponses

Utilisateur anonyme
12 mars 2006 à 12:42
Salut,

C'est tout a fait normal, tu vérifie si la clé est dans HKeyLocalMachine et non dans regKey
Esseye avec ca:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim apppath As String = My.Computer.FileSystem.CurrentDirectory & "\ControlClipBoard.exe"
Dim regkey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
If regkey.GetValue("ControlClipboard") Is Nothing Then
CheckReg.Checked = False
Else
CheckReg.Checked = True
End If
[...]
End Sub

Kenji
<hr size="2" width="100%">
Merci de cliquer sur "Réponse acceptée" si une réponse vous convient.
3
shadow1779 Messages postés 706 Date d'inscription mercredi 17 novembre 2004 Statut Membre Dernière intervention 29 septembre 2013
12 mars 2006 à 12:07
oups, bug forum :s

je vous reposte le code:



Private
Sub MainForm_Load(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles
MyBase.Load



Dim regkey
As Microsoft.Win32.RegistryKey



Dim apppath
As
String


apppath =
My.Computer.FileSystem.CurrentDirectory &
"\ControlClipBoard.exe"


regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
"SOFTWARE\Microsoft\Windows\CurrentVersion\Run",
True)



If Microsoft.Win32.Registry.LocalMachine.GetValue(
"ControlClipboard")
Is
Nothing
Then


CheckReg.Checked =
False



Else


CheckReg.Checked =
True



End
If



Dim myThread
As
New Thread(
AddressOf ChargerDonnees)


myThread.Start()



End
Sub
0
Rejoignez-nous