I'm creating an application where a user would fill in a bit of code (for example a SteamID), and whenever the user clicks the button, it will be copied to the clipboard.
The way it works is simple, the first time the program runs, and it detects both .txt's in the install dir are empty, the user will be prompted to fill that in.
Everything works until here.
Whenever the user clicks the button, I need a way of the program getting all text in the .txt file, and putting this in the users clipboard.
I've tried literally every method here, but it did not work, or I did not understand it as the code I found would only put text in clipboard that has been programmed into the code, and not that was put into a file.
You need a reference to System.Windows
or System.Windows.Forms
var content = File.ReadAllText("filepath.txt");
Clipboard.SetText(content);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With