views:

62

answers:

1

I want to highlight some stuff on a web page and be able to paste it into a richtextbox in C# winforms. I want to then be able to see the HTML code of what I had pasted. Is this possible?

+2  A: 

This snippet will return a string containing the code. There is some header info at the top that you may want to parse out but it is pretty straight forward.

string html = Clipboard.GetData(DataFormats.Html).ToString();

You will be able to populate that into a text box or richtext box however you like.

Jason Webb