how to change background Color of text in Textbox

Does anyone know how to change the background color of text in a textbox. I know this is possible using a richTextBox but I would like to do it using a textbox. The textbox is readonly and Im using it to display data.

Comments

  • [code]
    Me.TextBox1.BackColor = System.Drawing.SystemColors.Info
    Me.TextBox1.BackColor = System.Drawing.Color.Gainsboro
    [/code]

    -----
    : Does anyone know how to change the "background color of text" in a textbox. I know this is possible using a richTextBox but I would like to do it using a textbox. The textbox is readonly and Im using it to display data.
    :

    [red]Good luck![/red]
    [blue]Hackman[/blue]

  • : Does anyone know how to change the background color of text in a
    : textbox. I know this is possible using a richTextBox but I would
    : like to do it using a textbox. The textbox is readonly and Im using
    : it to display data.
    :

    Try this:
    http://freevbcode.t35.com/TextBoxBackgroundColour.html

    Hope this helps
  • : Does anyone know how to change the background color of text in a
    : textbox. I know this is possible using a richTextBox but I would
    : like to do it using a textbox. The textbox is readonly and Im using
    : it to display data.
    :

    This will work,
    Textbox.ForeColor = System.Drawing.Color."color u want"
  • If you want your users to pick the color that they want instead of always being the same, you could insert a color dialog into your form, and create a button or a label that says Background color or Text color, whatever. And insert this code for the click option:

    [code] ColorDialog1.ShowDialog()
    Me.BackColor = ColorDialog1.Color()[/code]

    That shows the Color Dialog, and allows the user to select a specific color, then makes the background (In this case) that specific color.

    Or, in another case, this code changes the Button, label, and that sort of thing's color.

    [code] ColorDialog2.ShowDialog()
    Me.ForeColor = ColorDialog2.Color()[/code]

    Be sure to use a different Color Dialog in every case. Notice of the first example I used Colordialog1 and for the second colordialog2?

    This is very basic code, but can go a long way, mess around with it and see what you can do :P
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories