Results 1 to 12 of 12
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Text color on Command Button (VB6)

    I've tried several of the properties to change the text color of a particular command button to Red, haven't been able to get it to work. Is it supposed to and I'm doing something wrong, or is it possible?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Text color on Command Button (VB6)

    Have you tried

    CommandButton1.ForeColor = vbRed

    Andrew C.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text color on Command Button (VB6)

    My command button properties (and it is the default one that came with VB6) does not have the .ForeColor property. I experimented with every property that appeared to have color related to it, listed below:

    'cmdRestore.MaskColor = vbRed
    'cmdRestore.BackColor = vbRed
    'cmdRestore.UseMaskColor = True

    I've also tried toggling the UseMaskColor property.

    In doing this I did figure out that if I change the mode of the button to Graphical, it will turn the background to whatever color is referenced in the MaskColor property.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Text color on Command Button (VB6)

    <P ID="edit" class=small>Edited by HansV on 09-Apr-02 16:17.</P>ForeColor is not a property of a standard CommandButton in VB6.

    The CommandButton object in the MSForms Object library does have a ForeColor property. If you right-click the Toolbox, you can add this library if it is available. Some controls will be added to the Toolbox, among which a CommandButton with a ForeColor property.

    Note added later: the MSForms library comes with MS Office and is not freely distributable. So if you want to deploy your application with the MSForms CommandButton, make sure that your users already have MS Office.

  5. #5
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Text color on Command Button (VB6)

    Right, the intent is to only allow you to change all button text with display properties, Appearance tab, 3D Objects.

    As Hans said, you need to use the Microsoft Forms command button. HTH --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text color on Command Button (VB6)

    Okay, I see what you are saying. That is the default command button that installs with VB6. I'm gathering that there is another command button I should select in my references somewhere.

  7. #7
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Text color on Command Button (VB6)

    Correct, right-click on the toolbox, select components, add the Microsoft Forms library, and use its command button. Remember, as mentioned, if you use the MS Forms command button, then you cannot distribute your application to someone who does not have Microsoft Office installed. --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text color on Command Button (VB6)

    Thanks, Sam...I think I am thinking of the MS Access command button. I'll add that library to my component list.

  9. #9
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Text color on Command Button (VB6)

    There isn't a separate Access library, all of the Office products use the Microsoft Forms library.
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Text color on Command Button (VB6)

    Actually, Access doesn't use quite the same controls as the rest of Office. I don't even think you *can* use Access controls in VB.
    Charlotte

  11. #11
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Text color on Command Button (VB6)

    Charlotte, you are absolutely correct. As you can tell, I avoid Access in order to keep my sanity. <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23> But, let me redeem myself: as far as I can see there is no Microsoft way to get any of the following Access controls or features into VB:<UL><LI>sub form
    <LI>multiple column (FIELD) combobox
    <LI>tab control that really works
    <LI>efficient bounding of controls[/list]However, if you want a text color on a command button, a toggle button or a transparent textbox, the MS forms controls will do it. --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  12. #12
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Text color on Command Button (VB6)

    <hr> I avoid Access in order to keep my sanity.<hr>
    But, Sam, that's why I avoid VB as much as possible and stick with Access! <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>
    Charlotte

Posting Permissions

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