[Gambas-user] make Label background from Database field

Vassilis K vkan53 at ...2300...
Thu Oct 15 00:53:34 CEST 2009


Hello,
I want to change the color of about 100 Labels of a form according to the 
values of a table in the database.
If the value of the field thesi is 12, I want to make Label12 look red (with 
red background color).
For this purpose I made the following :

PUBLIC SUB Form_Open()
  DIM rsThesi AS Result
  DIM i AS Integer
  ME.Title = "Sxedio"
  MODMain.Connect()
    rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax = 
0")
	FOR iD = 0 TO rsThesi!AA
             i = rsThesi!thesi
             Label(["i"]).Background = Color.Red 
       NEXT
    MODMain.$Con.Commit()
END

But I get the error :
"Type mismatch: Wanted Label got string instead"
Any ideas?



More information about the User mailing list