-3

I have to create some controls similar to a control TextBox. But I want this control can Highlight link as RichTextBox, Because I have problem with RichTextBox so i can't use it. How do I highlight a link in a TextBox? or I have to set each property by a line of code?

I want to display it in a TextBox as shown below:

not use Richtextbox

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291

1 Answers1

0

This is not possible. A simple TextBox control cannot be used to display formatted text.

A hyperlink is just specially formatted text: all it really does is change the foreground color to blue and the text style to underlined. TextBox controls don't allow this type of granularity. All text in the control has the same formatting applied to it.

What you would need to use is a RichTextBox control. This is specifically designed for displaying formatted text, and not only does it allow you to define arbitrary formatting for specific bits of text, but it has built-in support for detecting and highlighting hyperlinks. You say in your question that you had a "problem" with using the RichTextBox, so that is really the question that you should have been asking.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574