|
-
Apr 3rd, 2008, 08:44 PM
#1
Thread Starter
Lively Member
[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
Last edited by goldenix; Apr 3rd, 2008 at 09:21 PM.
-
Apr 3rd, 2008, 08:52 PM
#2
Frenzied Member
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
-
Apr 3rd, 2008, 09:09 PM
#3
Thread Starter
Lively Member
Re: If RegRead = Error then
 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
-
Apr 3rd, 2008, 10:49 PM
#4
Frenzied Member
Re: [Resolved]If RegRead = Error then
NP, my code didn't work because I used GetValue instead of GetSubKey(Folder), but same thing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|