• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 326
  • Last Modified:

setting the backcolor for a disabled textbox

I have been working on trying to set the color of a disabled textbox.  You can see some different things that I have tried.  It seems that if I use the "vbColor" property that I can get the backcolor set to vbBlue, vbRed, etc., but if I try to use system colors, I wind up with white.  I thought that if I set the textbox control to enabled = false that vb would "grayout" the box, but it doesnt look like it...any assistance?

If optSealed.Value <> True Then
        dblNewActUnitsValue = dblNewActValue / dblOldMassOrVolUnit
        lblActConcUnitsLabel.Caption = "" & strActivityUnit & "/" & strOldMassOrVolUnit & ""
    Else
        txtMassOrVolume.ForeColor = Gray 'returns a white background
        txtMassOrVolume.Enabled = False
        txtUncPercOneSigMassOrVol.Enabled = False
        txtUncPercOneSigMassOrVol.ForeColor = NavajoWhite 'returns a white background
        txtRefActConc.Enabled = False
        txtRefActConc.BackColor = Silver 'returns a black background
        txtUncPercActConcOneSig.Enabled = False
        txtUncPercActConcOneSig.BackColor = Silver 'returns a blank background
        lblActConcUnitsLabel.Caption = "" & strActivityUnit & ""
    End If

is there a property that I can set that will gray out the box when it is disabled to show that you cannot type a number in the box?

Thanks.

Mike
0
MikeORTEC
Asked:
MikeORTEC
1 Solution
 
ShauliCommented:
There is no property that will grey out the text box. You have to change the backcolor to grey, as in:

txtUncPercActConcOneSig.Enabled = False
txtUncPercActConcOneSig.BackColor = vbButtonFace

S
0
 
MikeORTECAuthor Commented:
Worked just like I wanted it to.

Thanks!

M
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now