Click here to Skip to main content
16,022,060 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how to clear windows system clipboard without pin coped text programmatically vb.net if I used clipboard.clear on button click it not work please help me to solve this problem.
I found on google PowerShell commend it is work but I don't know how to use it on vb.net visual basic 2010
My humble request that if any others code/program on vb.net visual basic please share

thanks

What I have tried:

I run it on PowerShell it is clear copy all without pin copy it is work fine my reequipment how to use on vb.net visual basic 2010 platform

Restart-Service -Name "cbdhsvc*" -force
Posted
Comments
OriginalGriff 15-Sep-24 1:39am    
I'm sorry, but that doesn't make much sense as written. What does "without pin coped text" mean? "It not work" tells us nothing: what does it do that you didn't expect, or not do that you did? How did you test what it did?

It might be that you want to write this question in your native language and then use Google Translate to get an English version, as I suspect you are using the wrong words and that throwing the text off - "coped" is almost certainly "copied" and "reequipment" is probably "requirement", but "pin copy" means nothing!

Please use the "Improve question" link to update your question.
Dave Kreskowiak 15-Sep-24 11:01am    
That PowerShell command does not "clear the clipboard". It's stopping and restarting the clipboard user service. That's a little extreme for "clearing the clipboard" because it impacts the clipboard system-wide.

If you want to "clear" the clipboard, what's wrong with just putting an empty string on it?

1 solution

Randomly clearing the clipboard is a great way to get your application blocked as "malware"!

I suspect this is actually an XY problem[^] - you're asking for help to implement the solution you think you need, rather than help solving the actual problem.

If you're writing code which (ab)uses the clipboard to transfer sensitive data, and you're trying to avoid having that data stored in the Windows 10+ clipboard history / roaming clipboard, you'll need to call Clipboard.SetContentWithOptions[^] to copy the data, rather than simply using the Clipboard class.

It's a WinRT method, so it's not particularly simple to call from an unpackaged .NET Framework app. But with a little reflection, it's doable:
Windows 10 Clipboard Utilities · GitHub[^]

If that's not what you're doing, then you're going to need to provide a clearer explanation of the problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900