1

私は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
4

1 に答える 1