View Single Post
  #2 (permalink)  
Old 10-20-2008, 09:59 AM
Mr_Gee Mr_Gee is offline
Basic4ppc Veteran
 
Join Date: Feb 2008
Location: Hilversum, The Netherlands
Posts: 295
Awards Showcase
Beta Tester 
Total Awards: 1
Default

What if you made a 2nd sub which checks this for you?

Code:
Sub Global
      key = 
"Software\My Application"
End Sub 

Sub Loadsettings

    CheckReg(
"ServerURL","http://ayvegh.com/~nico/")
End Sub

Sub CheckReg(What,Value)
  reg.New1
  reg.RootKey(reg.rtCurrentUser)
  ErrorLabel(NotCreatedYet)
  
msgbox("The value is: " & reg.GetValue(key,What))
  
return
NotCreatedYet: 
'creates the subkey if it didn't exist
  reg.CreateSubKey(Value,key&"\"&What)
  
msgbox("The key was created.")    
End Sub
BTW you might want to check the code, I'm not sure if
reg.CreateSubKey(Value,key&"\"&What)
is the correct way
Reply With Quote