Consulting

Results 1 to 7 of 7

Thread: Switching 3 colors on Form

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Switching 3 colors on Form

    Hello,
    I wonder how the following code must be updated so the back color is:

    1st click: yellow
    2nd click: red
    3rd click: blue
    4th click: yellow
    etc.

    Sub btnMyButton_Click()
    '   The background color is gray at the beginnng
    If frmMyForm.BackColor <> vbYellow Or frmMyForm.BackColor = vbRed Then
      frmMyForm.BackColor = vbYellow
    Else
    frmMyForm.BackColor = vbRed
    End If
    End Sub
    Thank you, Malak
    Last edited by Aussiebear; 04-25-2023 at 06:45 PM. Reason: Added code tags to supplied code

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
  •