Hi,

I renamed the subject, because the thread was too deep for my screen. :-)

The following 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

...does not work and raise "Result not available" because when you reach the 
end of the Result and call MoveNext(), the Index property switches to -1 (-1 
meaning "not available"). And as -1 is always lower then rsThesi.Count, the 
loop continues.

Writing `WHILE rsThesi.Index < rsThesi.Count - 1' does not raise the error, 
but you lose the last record of the Result! So it is wrong too.

So, as Werner wrote, the right way of writing that code is:

FOR EACH rsThesi
  ME["Label" & rsThesi!thesi].Background = Color.Red
NEXT

And the commit is useless, as you didn't write anything to the database.

And, finally, to Kad Mann: Vassili used a bunch of Labels and not a GridView 
because he used them for drawing a camping schema.

Regards,

-- 
Benoît Minisini

------------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to