[Gambas-user] make Label background from Database field

Benoît Minisini gambas at ...1...
Sun Oct 18 18:10:08 CEST 2009


> I get error:
> "Result is not available"
> at line:
> "change_bgcolor("Label" & rsThesi!thesi)"
> 
> of the code:
> 
> PUBLIC SUB Form_Open()
>   DIM i AS Integer
>   DIM rsThesi AS Result
>     MODMain.Connect()
>     rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax =
> 0")
>     rsThesi.MoveFirst
>     WHILE rsThesi.Index < rsThesi.Count
>       change_bgcolor("Label" & rsThesi!thesi)
>       rsThesi.MoveNext
>     WEND
>     MODMain.$Con.Commit()
> END
> 
> SUB change_bgcolor(labelname AS String)
>   DIM alabel AS Object '
>   FOR EACH alabel IN Form1.Children
>     IF alabel.name = labelname THEN
>       alabel.background = color.red
>     END IF
>   NEXT
> END
> 

Hi, Vassili.

I need your full project source and a SQL dump of your database, and which 
database backend you are using.

And change_bgcolor() can be written this way:

SUB change_bgcolor(labelname AS String)
  Form1[labelName].Background = Color.Red
END

Regards,

-- 
Benoît Minisini




More information about the User mailing list