Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 83535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:47:19+00:00 2026-05-10T21:47:19+00:00

I want to write Html format, but I can not even get a simple

  • 0

I want to write Html format, but I can not even get a simple MSDN example of it to work.

http://msdn.microsoft.com/en-us/library/tbfb3z56.aspx

Does this console app, a clipboard round tripper, work for anyone?

 using System; using System.Windows; //Need to add a PresentationCore or System.Windows.Forms reference  class Program {     [STAThread]     static void Main( string[] args ) {         Console.WriteLine( 'Copy a small amount of text from a browser, then press enter.' );         Console.ReadLine();          var text = Clipboard.GetText();         Console.WriteLine();         Console.WriteLine( '--->The clipboard as Text:' );         Console.WriteLine( text );          Console.WriteLine();         Console.WriteLine( '--->Rewriting clipboard with the same CF_HTML data.' );         //***Here is the problem code***         var html = Clipboard.GetText( TextDataFormat.Html );         Clipboard.Clear();         Clipboard.SetText( html, TextDataFormat.Html );          var text2 = Clipboard.GetText();         Console.WriteLine();         Console.WriteLine( '--->The clipboard as Text:' );         Console.WriteLine( text2 );          var isSameText = ( text == text2 );         Console.WriteLine();         Console.WriteLine( isSameText ? 'Success' : 'Failure' );          Console.WriteLine();         Console.WriteLine( 'Press enter to exit.' );         Console.ReadLine();     } } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:47:20+00:00Added an answer on May 10, 2026 at 9:47 pm

    When you copy data from a browser onto the clipboard, it puts the same data onto the clipboard in multiple formats, including both text and HTML. So you can read the data back out in either text or HTML format. However, when you call SetText here, you are ONLY passing in HTML format, so when you use the regular GetText, there is no text version on the clipboard and you get null back.

    You can put multiple formats onto the clipboard at once (i.e., both text and HTML) using IDataObject, but you have to do the translation between formats yourself before you put the data on the clipboard. There’s an example of how to use IDataObject here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 99k
  • Answers 99k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I've used the Assembly Binding Log Viewer (Fuslogvw.exe) or maybe… May 11, 2026 at 7:47 pm
  • Editorial Team
    Editorial Team added an answer Alec, You can definitely do this. I have a form… May 11, 2026 at 7:47 pm
  • Editorial Team
    Editorial Team added an answer Try to change the LANG environment variable: http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Environment-Variables.html#Environment-Variables. May 11, 2026 at 7:47 pm

Related Questions

I have a sketch that I want to put up on my website, and
I've created a small application to learn RoR. (Book database) It consists of a
The Back Story I have some decimal values which I am displaying as strings
I've been playing with Python for a while and wrote a little program to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.