Link to home
Start Free TrialLog in
Avatar of MikeORTEC
MikeORTEC

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Shauli
Shauli

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MikeORTEC
MikeORTEC

ASKER

Worked just like I wanted it to.

Thanks!

M