T Tomas Petrus Active Member Licensed User Longtime User Jan 20, 2016 #1 Hi, I have more labels in one panel and I need to give them same Background, TextColor, TextSize etc. Is there any easier way to do that than write it over and over again? Code: Copy Label1.TextColor = Colors.Black Label1.Gravity = Gravity.CENTER_VERTICAL Label2.TextColor = Colors.Black Label2.Gravity = Gravity.CENTER_VERTICAL Label3.TextColor = Colors.Black Label3.Gravity = Gravity.CENTER_VERTICAL . . . . Thanks for answer
Hi, I have more labels in one panel and I need to give them same Background, TextColor, TextSize etc. Is there any easier way to do that than write it over and over again? Code: Copy Label1.TextColor = Colors.Black Label1.Gravity = Gravity.CENTER_VERTICAL Label2.TextColor = Colors.Black Label2.Gravity = Gravity.CENTER_VERTICAL Label3.TextColor = Colors.Black Label3.Gravity = Gravity.CENTER_VERTICAL . . . . Thanks for answer
eurojam Well-Known Member Licensed User Longtime User Jan 20, 2016 #2 it works like this... Code: Copy Dim Label1(10) As Label For i = 0 To 9 Label1(i).TextColor = Colors.Black Label1(i).Gravity = Gravity.CENTER_VERTICAL Next Upvote 0
it works like this... Code: Copy Dim Label1(10) As Label For i = 0 To 9 Label1(i).TextColor = Colors.Black Label1(i).Gravity = Gravity.CENTER_VERTICAL Next
T Tomas Petrus Active Member Licensed User Longtime User Jan 20, 2016 #3 Thanks, but I can't use it. I need to have specific name and text for each Label and some times it is skipped because of empty value in database Upvote 0
Thanks, but I can't use it. I need to have specific name and text for each Label and some times it is skipped because of empty value in database
eurojam Well-Known Member Licensed User Longtime User Jan 20, 2016 #4 then you can put them explicit into an array or list like this: Code: Copy Dim labels() As Label labels= Array As Label (label1, label2, label3, label4) For i = 0 To labels.size-1 labels(i).TextColor = Colors.Black labels(i).Gravity = Gravity.CENTER_VERTICAL Next Upvote 0
then you can put them explicit into an array or list like this: Code: Copy Dim labels() As Label labels= Array As Label (label1, label2, label3, label4) For i = 0 To labels.size-1 labels(i).TextColor = Colors.Black labels(i).Gravity = Gravity.CENTER_VERTICAL Next
Erel B4X founder Staff member Licensed User Longtime User Jan 20, 2016 #5 If you are using lists or other structures (including array): Code: Copy For Each lbl As Label in labels lbl.TextColor = Colors.Black lbl.Gravity = ... Next Upvote 0
If you are using lists or other structures (including array): Code: Copy For Each lbl As Label in labels lbl.TextColor = Colors.Black lbl.Gravity = ... Next
M Mahares Expert Licensed User Longtime User Jan 20, 2016 #6 eurojam said: For i = 0 To labels.size-1 Click to expand... Actually this line: Code: Copy For i = 0 To labels.size-1 should be: Code: Copy For i = 0 To labels.Length-1 Not a big deal. Upvote 0
eurojam said: For i = 0 To labels.size-1 Click to expand... Actually this line: Code: Copy For i = 0 To labels.size-1 should be: Code: Copy For i = 0 To labels.Length-1 Not a big deal.