我有一个使用GetSubKeyNames
的数组。
我正在尝试为注册表中的每个配置文件写一个值,该配置文件位于我作为数组获取的配置文件的路径位置。
我下面的代码不起作用。这与& profileNames(index)
&我相信代码中的位。我正在尝试遍历数组,为每个数组配置文件名称创建一个新路径。
SoftwareKey = Registry.CurrentUser.OpenSubKey("Software")
Autodesk = SoftwareKey.OpenSubKey("Autodesk")
AutoCAD = Autodesk.OpenSubKey("AutoCAD")
R191 = AutoCAD.OpenSubKey("R19.1")
ACADD001409 = R191.OpenSubKey("ACAD-D001:409")
Profiles = ACADD001409.OpenSubKey("Profiles")
Dim profileNames() As String = Profiles.GetSubKeyNames()
Dim ProfileLgth As Integer = profileNames.Length
Dim index As Integer = 0
While index <= ProfileLgth
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.1\ACAD-D001:409\Profiles\" & profileNames(index) & "\Dialogs\Appload\Startup", "Dword", "Value")
index = index + 1
End While
答案 0 :(得分:0)
好的,使用我刚刚学到的不同方法解决了问题。这是:
For index = LBound(profileNames) To UBound(profileNames)
'MsgBox(profileNames(index))
Dim ProfileValue2014 As String = My.Computer.Registry.GetValue(
"HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.1\ACAD-D001:409\Profiles\" & profileNames(index) & "\Dialogs\Appload\Startup", "NumStartup", Nothing)
Dim ProfileValue2014add = Convert.ToInt32(ProfileValue2014) 'Change Appload value to an Integer from a string
Dim Number As Integer = ProfileValue2014add + 1 'Add 1 to Appload list
Dim NumberStr As String = Convert.ToString(Number) 'Convert Number back to string for registry to not crack the shits
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.1\ACAD-D001:409\Profiles\" & profileNames(index) & "\Dialogs\Appload\Startup", "NumStartup", NumberStr)
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.1\ACAD-D001:409\Profiles\" & profileNames(index) & "\Dialogs\Appload\Startup", NumberStr & "Startup", "C:\Program Files\Shadow Multi Cast\loadmnu.lsp")
Next index