• Text color on Command Button (VB6)

    Author
    Topic
    #369339

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #581308

      Have you tried

      CommandButton1.ForeColor = vbRed

      Andrew C.

      • #581347

        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.

        • #581391

          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

          • #581406

            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.

            • #581434

              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

            • #581632

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

            • #581633

              There isn’t a separate Access library, all of the Office products use the Microsoft Forms library.

            • #581753

              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.

            • #581791

              Charlotte, you are absolutely correct. As you can tell, I avoid Access in order to keep my sanity. hairout 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:

              • sub form
              • multiple column (FIELD) combobox
              • tab control that really works
              • 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
            • #581821

              [indent]


              I avoid Access in order to keep my sanity.


              [/indent]But, Sam, that’s why I avoid VB as much as possible and stick with Access! laugh

      • #581309

        Edited by HansV on 09-Apr-02 16:17.

        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.

    Viewing 0 reply threads
    Reply To: Text color on Command Button (VB6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: