Nayan
Nayan

Reputation: 3214

dotNet 4.0 Clipboard bug?

Try this:
1. Create an app in VS Express Edition 2010 (.NET 4.0).
2. Put these lines in the code wherever u like -

        string text = Clipboard.GetText();
        MessageBox.Show(text);

3. Copy some ANSI text (for simplicity) from notepad.
4. Run the app and see the result.

I see "Clipboard.GetText()" (without quotes) instead of actual data!

Can anyone confirm if this happens in Pro/Ultimate editions too?

Upvotes: 3

Views: 399

Answers (1)

Ian P
Ian P

Reputation: 12993

Try this instead and post your results:

string text = Convert.ToString(Clipboard.GetData(System.Windows.Forms.DataFormats.Text));
MessageBox.Show(text);

Upvotes: 2

Related Questions