This is a mirror of official site: http://jasper-net.blogspot.com/

Quick Tip: change text on the Clipboard before you paste CTRL + v

| Thursday, November 11, 2010
This quick tip describes how text from the Clipboard can be modified before the user inserts the text with CTRL + V in a TextBox

Notes

KeyDown event of a TextBox checks whether the user has pressed the key combination CTRL + V. If this is the case, the text from the Clipboard using the method assigns Clipboard.GetText() of a private variable. It follows a check whether the text in the Clipboard is an empty string. If not, is a modification of the text from the Clipboard intercepted. A substring is formed in the example above. Finally, the modified text using the method assigns SetText() of Clipboard.

When the user releases the key combination, the text on the Clipboard is now from the modified text and insert this text.

Read more: SilverLaw

Posted via email from .NET Info

0 comments: