[Resolved]If RegRead = Error then
Hi
so I searched & searched & all i found was loads of code that simply does not work so hire i am. I want to see if this folder exists in my registry. I know it does nt exists actually & i get error hire & im stuck. so can someone be so kind & help me out? this is what I want to do.
Code:
Dim objShell
objShell = CreateObject("WScript.Shell")
If objShell.RegRead("HKEY_CURRENT_USER\Software\_MyScripts\Alarm\") = Error Then
MessageBox.Show("Boo")
Else
MessageBox.Show("Bingo")
End If
Edit: For some reason i cant post so Ill edit:
That code of yours Icyculyr does not actually work, it outputs always bingo=folder exists even if it does not eexist. But that aside, that My.Computer.Registry.GetValue was really helpful & i figured it out. Thanx.
Code:
Dim readValue As Object
readValue = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\_MyScripts\Alarm", "Min_combo", Nothing)
If CStr(readValue) = "" Then
MessageBox.Show("boo")
Else
MessageBox.Show("Bingo")
End If
Re: If RegRead = Error then
Code:
Dim sFolderName As String = "Alarm"
Dim sReturnValue As String = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\_MyScripts\", sFolderName, Nothing) Is Nothing
If sReturnValue IsNot Nothing Then
'Exists
End If
Cheers
Re: If RegRead = Error then
Quote:
Originally Posted by Icyculyr
Cheers
That code of yours does not actually work, it outputs always bingo=folder exists even if it does not eexist. But that aside, that My.Computer.Registry.GetValue was really helpful & i figured it out. Thanx.
Code:
Dim readValue As Object
readValue = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\_MyScripts\Alarm", "Min_combo", Nothing)
If CStr(readValue) = "" Then
MessageBox.Show("boo")
Else
MessageBox.Show("Bingo")
End If
Re: [Resolved]If RegRead = Error then
NP, my code didn't work because I used GetValue instead of GetSubKey(Folder), but same thing