Question about textboxes and having part of the text as a different colour...

  • Thread starter Thread starter Paul Tomlinson
  • Start date Start date
P

Paul Tomlinson

I have a text box with the text "12345679813246579" in it.
I want the first 7 characters to be in a red colour with the remaining in
black. Is this possible?

MA
 
Perhaps a RichTextBox with Multiline set to false? Depends on exactly how you
wish things look and feel. Perhaps a cutsom control, say a panel that
provides a border for two borderless TextBoxes, one right aligned and the
other left aligned. Or derive a your own control from TextBox. But I don't
think this is doable "straight out of the box" so to speak. Hope this helps.
 
Paul Tomlinson said:
I have a text box with the text "12345679813246579" in it.
I want the first 7 characters to be in a red colour with the remaining in
black. Is this possible?

Yes, with a RichTextBox (but not with a TextBox). Take a look at
RichTextBox.Select and RichTextBox.SelectionColor.
 
Back
Top