Results 1 to 6 of 6

Thread: Resolved - Make text on button disappear and reappear

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Posts
    6

    Thumbs up Resolved - Make text on button disappear and reappear

    I'm stumped....

    I have buttons getting their text randomly on Form load.

    But I need them to hide the text until I click on the button. (But not hide the button)

    How do I make the text disappear until needed?

    Thanx for any help.

    Diane
    Last edited by Diane; Nov 21st, 2004 at 12:53 PM.

  2. #2
    Hyperactive Member Mosabama's Avatar
    Join Date
    Aug 2004
    Location
    Mars
    Posts
    306
    Make a string variable for each command...
    and

    command1.text = "" 'when you want to hide

    and use :

    command1.text = varstr ' its the variable that holds the random text that you created...
    My software never has bugs. It just develops random features.
    I RATE, YOU RATE!!!

  3. #3
    Addicted Member
    Join Date
    Apr 2004
    Location
    Lagos, Nigeria
    Posts
    215
    Hi Diane,

    All you need do is set the ForeColor of the button to it's BackColor. In the Click event of the button, set the ForeColor back to a color that is different from the BackColor.

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Posts
    6

    I'll give this a try

    Thanx for the fast feedback.

    I thought of changing the color, but couldn't find a good match. The backcolor was "control", and when you write the code, only "real" colors are options. So figure thats a dead end. But I still may be able to work on it, I'll try some more.

    the other code supplied I will definitely try tomorrow, and let you know!

    Thanx for now,
    Diane

  5. #5
    Addicted Member
    Join Date
    Apr 2004
    Location
    Lagos, Nigeria
    Posts
    215
    VB Code:
    1. 'in the form load event you can use this to hide the text
    2. Me.Button1.ForeColor = Me.Button1.BackColor
    3.  
    4. 'in the click event of the button, use this to show text
    5. Me.Button1.ForeColor = Me.ForeColor
    6. 'or
    7. Me.ForeColor = SystemColors.ControlText
    8. 'or
    9. Me.ForeColor = Color.Red
    10. 'etc

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Posts
    6

    Thumbs up resolved

    Well, glad to say, both methods worked!

    I will use the string variable for my code. Sometimes the obvious is hiding.....

    And on the bright side, I now know more about changing forecolor and backcolor !!!

    Cheers and many thanx,
    Diane

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