Hello:
I’ve just purchased the MBS Plugins for Xojo and I was hoping to get some assistance with adding String Values to a key.
Thus far, I am able to successfully get this far with creating keys.
var my_registry As New RegistryMBS
var regKey As RegistryKeyMBS = my_registry.CurrentUser.Item("Software")
var key As RegistryKeyMBS = regKey.Item("My Test App")
if key = Nil then // Create the Key
var sntKey As RegistryKeyMBS = regKey.CreateKey("My Test App", False)
Call sntKey.CreateKey("AppSettings")
end if
What I’d like to do now is add two (or more) string values to the newly-created “My Test App” key in the Windows Registry. In the Windows Registry, the two fields are:
-
Name
-
Data
Thoughts?
Well, if you have the key, you should be able to assign values. If I remember correctly, it is:
key.value(“test”).asString = “Hello”
Thanks! I’ll give it a go.
I knew that I was really close. Here’s what ended up working and thanks for your help!
var registry As New RegistryMBS
var root As RegistryKeyMBS = registry.CurrentUser
var key As RegistryKeyMBS = _
root.CreateKey("Software\mycompany\appname\userguidelineslink")
// Create or retrieve the value
var value As RegistryValueMBS
value = key.Value("user")
value.asString = "guidelines")
key.Flush
Anyone wanting/needing to use the Windows Registry should check out the MBS Plugins. I prefer it over dealing with Declare statements.
Just for posterity, you don’t need Declares; Xojo does have a built-in RegistryItem class that handles the Windows registry quite competently.
But I would never deter someone from using MBS either. It’s a wonderful package and Christian puts a lot of care and thought into his classes. To me it’s worth every penny.
2 Likes
I purchased the entire library. There are a number of good components that I can definitely leverage.
1 Like