pvg1975
asked on
Working with Labels inside TableLayoutPanel
Hello all,
I have a TableLayoutPanel I am populating with 450 Labels:
For t = 0 To 29
For x = 0 To 14
Counter = Counter + 1
Dim tBox As New Label With {.Name = "Table" & Counter, .Text = Counter, .BackColor = Color.Green, .ForeColor = Color.White, .Height = 16, .Width = 45, .TextAlign = ContentAlignment.MiddleCen ter}
TABLA.Controls.Add(tBox, x, t)
Next
Next
Each label has a name as Table1, Table2, Table3, etc
Here are my questions:
1) After the TableLayoutPanel is populated, how do I change the background color of a Label? As you can see above, all labels are background colored as .BackColor = Color.Green I need to change some of them to RED
2) How to I capture a CLICK event on one of the Labels?
As you can see, each label has a number (from 1 to 450), I just simply need to display the text contained on the clicked label into another label called XTABLE
Thanks!
I have a TableLayoutPanel I am populating with 450 Labels:
For t = 0 To 29
For x = 0 To 14
Counter = Counter + 1
Dim tBox As New Label With {.Name = "Table" & Counter, .Text = Counter, .BackColor = Color.Green, .ForeColor = Color.White, .Height = 16, .Width = 45, .TextAlign = ContentAlignment.MiddleCen
TABLA.Controls.Add(tBox, x, t)
Next
Next
Each label has a name as Table1, Table2, Table3, etc
Here are my questions:
1) After the TableLayoutPanel is populated, how do I change the background color of a Label? As you can see above, all labels are background colored as .BackColor = Color.Green I need to change some of them to RED
2) How to I capture a CLICK event on one of the Labels?
As you can see, each label has a number (from 1 to 450), I just simply need to display the text contained on the clicked label into another label called XTABLE
Thanks!
ASKER
Thanks idle_Mind. Where should I place that code? On the TableLayoutPanel?
Im new at this :)
Im new at this :)
ASKER
Oh I get it, but is it possible to click on the labels?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!!
Open in new window