1
我有12 controls
,我想在for循環中更改它們的值。我嘗試了很多方法,但是我無法解決這個問題。如何更改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
明確解釋你的問題嗎? –
好吧,所以我有12個按鈕放置窗體窗體,我想創建循環,然後啓動1到12按鈕啓用屬性在for循環中爲false。對不起,我的英語不夠清楚地解釋這個問題。謝謝。 – brooqs
什麼類型是'swButtons()'?他們是按鈕嗎?什麼是'sw0.Value','sw1.Value'等?換句話說,如何定義'sw0.Value'和其他? – Tim