Button color to 0's and 1's 07-07-2013, 12:02 AM
#1
I', struggling with this small piece of code that gives 1 for green and 0 for red for each button in a group box. If I do this:
It does't work in order, it gives the data in random order. The solution (I think) is this:
BUT IT DOESN'T WORK !!! It gives to zeros that are flashing like crazy. There is no think that I haven't tried. This might be stupid, but very frustrating little pesky problem. Please help.
EDIT: You can see the above two snippets differ from only this
Code:
h.Name = "out" & btnno And
Please, anyone HELP !!! I need this very much.
Code:
Private Sub tmr_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmr.Tick
For Each h As Button In outGB.Controls
If TypeOf h Is Button Then
If btnno >= 9 Then
btnno = 0
Else
btnno += 1
End If
If h.BackColor = Color.Green Then
result &= "1"
ElseIf h.BackColor = Color.Red Then
result &= "0"
End If
End If
Next
Label1.Text = result
result = String.Empty
End Sub
Code:
Private Sub tmr_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmr.Tick
For Each h As Button In outGB.Controls
If TypeOf h Is Button Then
If btnno >= 9 Then
btnno = 0
Else
btnno += 1
End If
If h.Name = "out" & btnno And h.BackColor = Color.Green Then
result &= "1"
ElseIf h.Name = "out" & btnno And h.BackColor = Color.Red Then
result &= "0"
End If
End If
Next
Label1.Text = result
result = String.Empty
End Sub
EDIT: You can see the above two snippets differ from only this
Code:
h.Name = "out" & btnno And
Please, anyone HELP !!! I need this very much.
![[Image: mU9i19G.gif]](http://i.imgur.com/mU9i19G.gif)