Windows Develop Bookmark and Share   
 index > Windows Forms Designer > How to change disabled textbox fonts color ?
 

How to change disabled textbox fonts color ?

When the textbox1.enabled = false, the fonts color changed to gray. 

Is it possible to change the fonts color to black color when it is disabled?

Thanks,
Terrence
MigrationUser 1  Tuesday, August 19, 2003 2:05 PM
Only if you <u>want</u> to. Here you go:    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Enabled Then
            TextBox1.BackColor = Color.Black
            TextBox1.Enabled = False
        Else
            TextBox1.Enabled = True
            TextBox1.BackColor = Color.White
        End If
    End Sub
MigrationUser 1  Tuesday, August 19, 2003 3:42 PM
I think that you are answering a different question.  :)

The easiest way to accomplish what the OP is interested in is to use the ReadOnly property of the textbox rather than the enabled property...
MigrationUser 1  Tuesday, August 19, 2003 4:32 PM
You're right. I thought he was talking about the background property. Looks like I'd made the question harder than it needed to be.
MigrationUser 1  Tuesday, August 19, 2003 5:11 PM
I have a comboList box which also need this feature. However, in the combolist box there is no readyonly properties.

Any help is appreciated.

Thanks.
MigrationUser 1  Wednesday, August 20, 2003 1:22 PM
You are correct, combobox does not provide a ReadOnly property...  I believe that one of the items on a future feature list somewhere regarding Windows Forms is "more controls with ReadOnly properties."  As for implementing this now, rather than in the future, I would set the DropDownStyle property of the ComboBox to DropDownList to prevent editing of the Textbox portion.  Then, to prevent the drop down, check out the thread <a href="http://www.dotnet247.com/247reference/msgs/22/110945.aspx">here</a>.

Important note:  Changing the drop down style of the ComboBox at runtime will cause the Handle to be recreated.  So, if you are using the handle anywhere, be careful...
MigrationUser 1  Wednesday, August 20, 2003 3:37 PM

You can use google to search for other answers

Custom Search

More Threads

• Control can be designed, but Form using it can't
• Loading a UserControl into a Panel on Form
• Making the Property Hide according to control in Multiple selection.
• Visual Studio Windows Forms Designer ArgumentException Error
• How to I avoid a control becoming a child of a container in the designer?
• Form size problem
• On tabpage enter focus textbox...?
• Properties help
• How to assign string resource to user control's property at design time?
• DockStyle.Top collection renders controls in reverse order