[Gambas-user] make Label background from Database field

Vassilis K vkan53 at ...2300...
Sun Oct 18 15:17:34 CEST 2009


Dimitri it worked !!

I put the code that you suggested and it works only when I put a number 
smaller than rsThesi.Count . For example when I put 10 it shows 10 Labels 
coloured !

I ' m writing down the code that worked:

PUBLIC SUB Form_Open()
  DIM rsThesi AS Result
  DIM iTemp AS Integer
  DIM sTemp AS String
    MODMain.Connect()
    rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax = 0 
AND thesi <> 0 ")
   
   DO WHILE rsThesi.Index < 10
   	 change_bgcolor(CInt(rsThesi!thesi))
    	 rsThesi.MoveNext()
   LOOP
END

PUBLIC SUB change_bgcolor(pos AS Integer)
   SELECT CASE pos
        CASE 1
          Label1.Background = Color.Red
        CASE 2
          Label2.Background = Color.Red
        CASE 3
          Label3.Background = Color.Red
        CASE 4
.......up to CASE 100 !!!!!!!!!!!!
	CASE ELSE
  END SELECT
END






More information about the User mailing list