-2

I haven't used C# that much, but I wanted to try it since it was the best language for the project I'm working on, but I've tried to find how to save text to clipboard, and whenever I try Clipboard. it says "Cant resolve symbol Clipboard"

UA Client
  • 23
  • 6
  • 1
    Please update post to show your attempt, we have no clue what code you're trying. – Trevor Jun 19 '21 at 15:41
  • 1
    Add some info about the framework you use and the type of project is it WPF or winforms or console application, any way see these answer [.Net Core - copy to clipboard](https://stackoverflow.com/questions/44205260/net-core-copy-to-clipboard) and [How do I copy the contents of a String to the clipboard in C#](https://stackoverflow.com/questions/44205260/net-core-copy-to-clipboard) – Ibram Reda Jun 19 '21 at 16:02

2 Answers2

1

If it's a console application it doesn't automatically come with System.Windows.Forms, which is needed for Clipboard, to add it, add it to your references by right clicking the project in vs or edit csproj.

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
SP73
  • 395
  • 6
  • 18
0

If you are doing a .Net Core, the Clipboard can now be found in the System.Windows namespace; add that to your usings by selecting the squiggly lines or Alt-Enter to provide intellisense options for missing references.

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122