Android Question Saving label text colours to an array

Discussion in 'Android Questions' started by Roger Daley, Jan 26, 2015.

  1. Roger Daley

    Roger Daley Well-Known Member Licensed User

    Hi All,

    I know I should know this one, but the brain cells just don't click.

    I have a number of lables lblF0 - lblF15 in which the textcolour changes. At some point I need to preserve the current text colours. I have attempted to do this in a for/next in various ways but all have failed.
    Below was the code starting point but this stores a string [eg "lblF1.TextColor"] not the color number.

    Dim Fcolours(16As String
    For FCol = 0 To 15
            Fcolours(FCol) = 
    Regards Roger
  2. NJDude

    NJDude Expert Licensed User

    Save those values in the label's TAG.
  3. Roger Daley

    Roger Daley Well-Known Member Licensed User

    Sorry NJDude,

    Can you be more explicit?
    Saving the values isn't really the problem, getting them via recursion instead of 16 lines of code to get them one by one is the problem.

    Regards Roger
  4. NJDude

    NJDude Expert Licensed User

    You will have to create an array of labels if you want to use a loop, otherwise, you will have to write 16 lines of code.
    Roger Daley likes this.
  5. Mahares

    Mahares Well Known Member Licensed User

    @NJDude: I was thinking something like this. Can we get your blessing:
    Dim arrLabel(16)  As Label
    For i=0 To arrLabel.Length-1
  6. NJDude

    NJDude Expert Licensed User

    Bless you my son.
  7. stevel05

    stevel05 Expert Licensed User

    If you can now read the colour directly from the Label, do you need to store it somewhere else?

    Edit, sorry should have reread the first post.:(
    Roger Daley likes this.
  8. Roger Daley

    Roger Daley Well-Known Member Licensed User

  9. Roger Daley

    Roger Daley Well-Known Member Licensed User


    I should have said in first post the text colour in the label indicates if there is an associated function. In some modes all these functions are disabled and re-enabled in the original mode. Therefore I need to save the text colour when leaving on mode and restore it when returning.

    I thought a For/Next loop would be simple, I have gone for the 16 lines of code solution.

    Thanks for the reply
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice