Android Question LabelView(i).Text

Mr Blue Sky

Active Member
Licensed User
Longtime User
Hi,

I despair of finding help to do this or just about the same !

What to do
LabelView1.Text = Cur.GetString(RefColumnDB & "1")
LabelView2.Text = Cur.GetString(RefColumnDB & "2")
LabelView3.Text = Cur.GetString(RefColumnDB & "3")
LabelView4.Text = Cur.GetString(RefColumnDB & "4")
LabelView5.Text = Cur.GetString(RefColumnDB & "5")
Etc..............................................

What i want
For i = 0 To Cur.RowCount - 1
LabelView(i).Text = Cur.GetString(RefColumnDB & i)
Next
 

klaus

Expert
Licensed User
Longtime User
Private LabelViews(5) As Label
LabelViews = Array As Labels(LabelView1, LabelView2, LabelView3, LabelView4, LabelView5)


For i = 0 To Cur.RowCount - 1
LabelView(i).Text = Cur.GetString(RefColumnDB & (i + 1))
Next
 
Upvote 0

Mr Blue Sky

Active Member
Licensed User
Longtime User
Klaus, merci encore ! c'est parfait, clair concis et fonctionnel que du bonheur...

Private LabelViews(5) As Label
LabelViews = Array As Label(LabelView1, LabelView2, LabelView3, LabelView4, LabelView5)


For i = 0 To Cur.RowCount - 1
LabelView(i).Text = Cur.GetString(RefColumnDB & (i + 1))
Next
 
Upvote 0

Mr Blue Sky

Active Member
Licensed User
Longtime User
Autre exemple fonctionnel pour la communauté pour mise à jour des labels depuis une base de données. Changement de langue par exemple. (Klaus)

Sub LabelEquips

Private Labels(52) As Label
Labels = Array As Label(Label1, Label2, Label3, Label4, Label5, Label6, Label7, Label8, Label9, Label10, Label11, Label12, Label13, Label14, Label15, Label16, Label17, Label18, Label19, Label20, Label21, Label22, Label23, Label24, Label25, Label26, Label27, Label28, Label29, Label30, Label31, Label32, Label33, Label34, Label35, Label36, Label37, Label38, Label39, Label40, Label41, Label42, Label43, Label44, Label45, Label46, Label47, Label48, Label49, Label50, Label51, Label52)

Cur = SQL1.ExecQuery("SELECT * FROM LabelDUO")
For i = 0 To Cur.RowCount - 1
Cur.Position = i
Labels(i).Text = Cur.GetString("ElementLabel")
Next
Cur.Close

End Sub
 
Upvote 0
Top