Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

VS 2010 Background color of multiple labels

$
0
0
I've created 10 labels in runtime. They're ordered in horizontal, so when one finishes the other starts.
In the program I introduce random letters. Some letters have a black value, other letters have a white value/color.
When I introduce one letter the program fills the Label.Backcolor using white or black.


The labels are from 0 to X (Label(0)....Label(14)) ordered from left to right (low to high).
The problem starts when I introduce one letter and I want to move the colors one position to right.

For example:
Label(0) BLACK
Label(1) WHITE

After I introduce 1 white value...
Label(0) WHITE
Label(1) BLACK (before it was Label(0))
Label(2) WHITE (before it was Label(1))

I've tried this
Code:

        Dim G As Integer
        For G = 0 To MatrixA - 1
            If Label(G).BackColor <> Color.LightGray Then
                Label(G + 1).BackColor = Label(G).BackColor
            End If
        Next G

but something I'm doing in an incorrect way

Viewing all articles
Browse latest Browse all 27189


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>