各ボタンが有効か無効かを確認できる For Each ループを実行したいと考えています。ボタンが有効になっている場合は、各ボタンのタグで値を取得する必要があります。それぞれ異なる値 (賞金) を含む 26 個のボタンがあります。*重要: このコードはボタンの下に配置する必要があるため、6 回押すたびにボタンをチェックします。
擬似コード:
btncase1.tag = 5
Begin while statement to go through each button
Check each button to see if it is enabled
If button is enabled then obtain values
Next
私が持っている実際のコードですが、私には意味がありません:
Public Class Form1
Dim button As Button
Dim totalremcases As Integer
Dim btncase As New Control
Dim btncollection As New Microsoft.VisualBasic.Collection()
Private Sub btncase1_Click()
For Each button As Button In btncollection
If btncase.Enabled Then
totalremcases = totalremcases + CInt(btncase.Tag)
End If
Next