0

I have a windows forms application that gets an ID, or more, in a richtextbox and validates it. If the ID or IDs is invalid will be highlighted in yellow.

richTextBoxCode_.SelectionBackColor = Color.Yellow;

What I want is to switch the richtextbox with a textbox but seems textbox doesn't have the SelectionBackColor . Is there any way to do this in a textbox? Thanks!

Bogdan Sorin
  • 129
  • 3
  • 14
  • Basically this is defined by system settings and can't be changed. But if you need this very much you can look here https://stackoverflow.com/questions/34666064/change-the-textbox-highlight-color-when-a-user-selects-text – demonplus Feb 07 '18 at 07:26
  • txtTextBox.ForeColoe = Color.Yellow; ? – Oswald Feb 07 '18 at 07:27
  • txtTextBox.ForeColor changes the fore color of the text. What I need is to keep same text color but highlight the background of the selection. @Oswald – Bogdan Sorin Feb 07 '18 at 07:34
  • So then i do agree with demonplus @BogdanSorin – Oswald Feb 07 '18 at 07:35
  • I've answered [almost the same question](https://stackoverflow.com/questions/48222621/how-to-highlight-the-wrapped-text-in-a-control-using-the-graphics/48257170#48257170) a few days ago. See if it helps. – Jimi Feb 07 '18 at 09:47
  • Thanks for help, thumb up! – Bogdan Sorin Feb 07 '18 at 13:04

0 Answers0