Misa
Misa

Reputation: 133

Link clicked RichTextBox

How can I get the link that I have clicked and pass it to the textBox?

I know how to pass it to browser...

    private void Link_Clicked (object sender, System.Windows.Forms.LinkClickedEventArgs e)
{
   System.Diagnostics.Process.Start(e.LinkText);
}

Upvotes: 0

Views: 103

Answers (2)

adv12
adv12

Reputation: 8551

Something like this should work:

private void Link_Clicked (object sender, System.Windows.Forms.LinkClickedEventArgs e)
{
   myTextBox.Text = e.LinkText;
}

(Here, myTextBox is the name of the RichTextBox into which you want to insert the text.)

Upvotes: 1

dwardu
dwardu

Reputation: 633

Why not cast the sender to a (LinkButton)sender and then get the url text from there? If you know you are always using a LinkButton.

Upvotes: 0

Related Questions