Vassilis K ha scritto:
> Dimitri
>
> I changed it to your proposed option and I get : 
> "Result is not available" 
> error at line:
> SELECT CASE rsThesi!thesi
>
> I do not know why it doesn't read the Result from database!!!
>
> You are right about the grid option. It looks more logical for 100 Labels!
> But I have made an image and put the Labels on it! So it is better to have an 
> image than a grid!
>   
Given that you have created 100 labels in Form1, without using in-middle 
containers (ie, all the labels reside directly on form1), you can change 
properties of each one with the following example routine:

sub change_bgcolor(labelname as string)
  dim alabel as Label

  for each alabel in Form1.children
    if alabel.name = labelname then
      alabel.background = color.red
    end if
  next
end

You should use this subroutine in code like this:

    WHILE rsThesi.Index < rsThesi.Count
      change_bgcolor("Label" & rsThesi!thesi)
      rsThesi.next
    wend

...or something like that,

If you used some in-middle container to arrange your labels, then you 
must use the name of that container instead of "Form1" in the subroutine 
above, because the labels are no more children of Form1 but children, 
for example, of VBox1 (well, Form1.Vbox1).

You see, you can scan all the children of a container (and a form *is* a 
container). The example routine scans all the children until it finds 
the one you want, by name (passed in parameter). A more general method 
would be to write a subroutine returning a reference to the label, 
instead of setting properties directly in the subroutine.  This would be 
far better from the cleaness of the code.

Regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."


------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to