Results 1 to 4 of 4

Thread: [Resolved] Alternate colour displays on the button

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2005
    Posts
    32

    [Resolved] Alternate colour displays on the button

    Hi guy, am new to vb.net. I want to ask a question whereby, if I have created a button, and I wanted this button to change colour evey after a click.
    I know can use Button1.backcolor= colour.Black, but i wanted to have two different colours.
    Example from black->white for 1st click and from white->black after the 2nd click and this will go on for each and every click.
    If anyone knows how to do it please help me, post your codes to to let me have a clearer picture too. Thank you every much.
    Last edited by jtVNB; Oct 10th, 2005 at 09:53 AM. Reason: Resolved

  2. #2
    Addicted Member
    Join Date
    Feb 2003
    Posts
    183

    Re: Alternate colour displays on the button

    If you only wanted to do it with two colours then this would work...

    Code:
            If Button1.BackColor.Equals(Color.White) Then
                Button1.BackColor = Color.black
                Button1.Forecolor = Color.White
            Else
                Button1.BackColor = Color.White
                Button1.Forecolor = Color.Black
            End If
    Look into the heart of infinity and find your truth

    Colonel Tom Edwards: This is the most fantastic story I've ever heard
    Jeff Trent: And every word of it's true, too
    Colonel Tom Edwards: That's the fantastic part of it

    ROFL

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2005
    Posts
    32

    Re: [Resolved]Alternate colour displays on the button

    Oh.. thank you every much!
    Been spending hours trying to solve it... thanks for ur codes

  4. #4
    Addicted Member
    Join Date
    Feb 2003
    Posts
    183

    Re: [Resolved] Alternate colour displays on the button

    No probs m8
    Look into the heart of infinity and find your truth

    Colonel Tom Edwards: This is the most fantastic story I've ever heard
    Jeff Trent: And every word of it's true, too
    Colonel Tom Edwards: That's the fantastic part of it

    ROFL

Posting Permissions

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



Click Here to Expand Forum to Full Width