dcsimg
Results 1 to 3 of 3

Thread: [RESOLVED] Help! Backcolor only changes the first element of a control array's color

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2019
    Posts
    6

    Resolved [RESOLVED] Help! Backcolor only changes the first element of a control array's color

    I've createda small code which turns a command button red after pressing it. There are multiple command buttons in the array, all called C2. There are also the C1's and the C0's. This is the code:

    Code:
    Private Sub C2_Click(a As Integer)
    C2(a).BackColor = &HC0&
    C2(a).Enabled = False
    C1(a).Enabled = False
    C0(a).Enabled = False
    puntos = puntos + 2
    PPP.Caption = puntos
    End Sub
    Whenever I run it, everything works fine except for the backcolor, which only works when pressing the first one. After a little experimenting I found out that no matter whether I change it to something like:

    Code:
    C2(3).BackColor = &HC0&
    It still won't work. What's more is that if I do it like that the first one (C2(0)) won't work.

    Any idea as to why this happens?

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,716

    Re: Help! Backcolor only changes the first element of a control array's color

    Is the Style Graphical for all of your CommandButton controls?

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2019
    Posts
    6

    Re: Help! Backcolor only changes the first element of a control array's color

    Oh! That was it, thanks! I can't believe I didnīt see that

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width