Remove HyperLinks from text - c#

I need help with it and i'm sure its simple but I cant figure it out.
In my rich text box I copy a link in and I dont want it to be a hyperlink.
So how do I remove the hyperlink?

It seems you're asking about hyperlinks in the RichTextBox in Windows Forms. If so, it's simply a matter of setting the DetectUrls property to false:
richTextBox1.DetectUrls = false;

string BadInput=Textbox.Text....
string GoodInput=BadInput.Replace("<","<").Replace(">",">");
Of course, this is assuming you don't want any HTML to be allowed in the text box.

Related

Devexpress Winforms tileview substring text forecolor

Is it possible to change the forecolor of substring in element text in GridControls's Tileview in devexpress winforms?
What's going to happen is I have a textbox and tileview
In event while textbox textchanged fire, the text matched in tileview's element text will be highlighted
The initial color of tileview's text will be blue and if its match with textbox's text it will be highlighted as gray.
See picture to check the illustration:
Is it possible? or will i need another component to attain this output?
As far I can see there is property group called Appearance (TileView.Appearance) and there you have property called ForeColor. Moreover, you can acces via code by calling
titleViewName.Appearance.ForeColor = <RGB value goes here>
Finally, there is possibility for dynamic customization via event ItemCustomize.
For further information please check official documentation and DevExpress forum. There already existis questions similiar to yours.
You can try to use HTML Text formating for displayed string:
Text = "This is some <color=red>red or <color=black><b>bold</b> text!"

make the Text of Textbox invisible

Is it possible some how to make the Text of the Textbox invisible or to hide it so the user can't see it , yet it get's the input/keys from the user?
It's better to rely on the built-in capabilities.
For instance, consider to use the TextBox.PasswordChar property.
You can set ForeColor = BackColor
Paste in your Properties -> Behavior -> PasswordChar symbol you need, empty blanks works too.

Highlighting particular text ina WPF textbox and registering event to that text only

In my WPF application I am having some following type of textbox
So, In this textbox, the text is not written by user it is generated by program, i wish to Highlight the particular text "Enter String Value" and when user clicks on that particular highlighted text only then I wish to fire a event.
Can u guys give me some hint or overview to achieve this. I tried few tricks but can't get success.
Thanks in advance.
Use <RichTextBox> with <FlowDocument>. As I know, TextBox allow you to determinate font (color, size, etc.) only one time, and you wouldn't able to modify color of partial text in one TextBox
I think you can use Regex to get your match from your textbox, and then create Run objects using that match. You can set the Background of the match (runobject.Background = Brushes.Red)

How to add HTML Markup to a textbox or label Control in a windows form C#

Let's say that my textbox control is named messageTB. I would like to know if it is possible to do the following:
messageTB.Text = "Hello <b>World</b>"
and have the output text to show "Hello World". In other words is there a way to enable html markup for the control? I am using visual studio.
The standard windows forms textbox control can't do it.
If you want formatted text you need a richtextbox or some other control.
There's a browser control that you could insert (rather than a textbox or label). Here's how to set the contents...
string html = "<html><body><strong>HelloWorld!</strong></body></html>";
Browser.DocumentText = html;
No. messageTB would have to be a Literal control for this to work.
It's clumsy, but I have used two adjacent Textboxes, one with format set to bold, to do this.
At least I get the look I want on the page.

Display string item in windows - C#

I have a string with dots and carriage returns etc... totally its a big string!
I want to show it in a windows form, so i wanted to know which one will be the good control to show it upon.
Thanks in advance,
Ravi Naik.
Use a TextBox with the Multiline property set to True.
Alternatively you can use a RichTextBox control or a WebBrowser control where you set the DocumentText property.
I would probably use a RichTextBox for displaying the plain text. Check out the AppendText method.

Categories