我有 12 个controls
,我想在 for 循环中更改它们的值。我尝试了很多方法,但我无法解决这个问题。
这是我的代码:
Dim serviceNames() As String = {"Security Manager Remote Recorder", _
"Security Manager Filter", "Security Manager Prob", _
"Security Manager Intelligence", "Security Manager Maintenance", _
"Security Manager Action", "Security Manager Agent Check", _
"Security Manager Control", "Security Manager Deploy Copy", _
"Security Manager Monitor", "Security Manager Reloader", _
"Security Manager Schedule"}
Dim swButtons() = {sw0.Value, sw1.Value, sw2.Value, sw3.Value, sw4.Value, _
sw5.Value, sw6.Value, sw7.Value, sw8.Value, sw9.Value, sw10.Value, sw11.Value}
For q As Integer = 0 To serviceNames.Count - 1
Dim regService = My.Computer.Registry.GetValue( _
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\" + _
serviceNames(q) + "", "Start", "")
If regService = 2 Then
swButtons(q) = True
End If
If regService = 4 Then
MetroTabItem5.Text = "bu 4"
End If
Next