Clipboard.SetText("")
throws me an error - "Value cannot be null". So how do I copy an empty string using Clipboard.SetText
?
I have already done Clipboard.Clear()
. It does clear the clipboard, but it doesn't help me to paste an empty string
Any suggestions?
If you try to save null or an empty string using Clipboard.SetText
it will never work.
See Clipboard.SetText Method (String) (MSDN). It mentions ArgumentNullException is thrown if the text is null or Empty
for Clipboard.SetText
.
Hence you cannot achieve what you are trying to achieve.
I think you need to do
Clipboard.Clear()
From MSDN
Clears any data from the system Clipboard.
See Clipboard.Clear Method (System.Windows.Forms) (MSDN).
Clipboard.Clear();
will clear the clipboard, so you will "paste" an empty string.
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