[Gambas-user] make Label background from Database field

Dimitris Anogiatis dosida at ...626...
Thu Oct 15 22:12:24 CEST 2009


Vassili,

It's not going to work
#1 cause you're defining a dynamic array with no apparent bounds

#2 it's going to create a synchronization problem that way
because if rsThesi!AA is an autoincrement field (unless I'm
guessing wrong) and if you delete and add a row then things
tend to get a bit messy

I am not sure if there is such a property but if there is something like

rsThesi.Count in your loop do this

FOR iD = 0 TO rsThesi.Count -1
  $alblTime.Add(NEW Label(ME))
  $alblTime[iD].Background = Color.Red
NEXT

and iD should be the same type as rsThesi.Count
(if not you might get an error)

I hope this works for you and I hope I helped

Regards,
Dimitris

On Thu, Oct 15, 2009 at 12:46 PM, Werner <wdahn at ...1000...> wrote:

> Vassilis K wrote:
> > I changed it as you said :
> >
> > PRIVATE $alblTime AS NEW Object[]
> >
> > PUBLIC SUB Form_Open()
> >   DIM i AS Integer
> >   DIM rsThesi AS Result
> >   DIM iD AS Long
> >
> >   MODMain.Connect()
> >     rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax
> =
> > 0")
> >        FOR iD = 0 TO rsThesi!AA
> >              i = rsThesi!thesi
> >               $alblTime[i] = NEW Label(ME)
> >               $alblTime[i].Background = Color.Red
> >        NEXT
> >     MODMain.$Con.Commit()
> > END
> >
> > Now I get "Out of bounds" error at line : $alblTime[i] = NEW Label(ME)
> > Did I make something wrong?
> >
> It is data dependent. What happens when
>      i = rsThesi!thesi
>     $alblTime[i] = NEW Label(ME)
> where rsThesi!thesi is -5000?
>
> Regards,
> Werner
>
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list