I have a VB.Net application and i need some way of capturing and overriding the Ctrl-V (Paste) command so that i can determine what occurs on those key events. I want to my own custom procedure to run on Ctrl-V, not paste.
In my code, i have first captured when the Control key is pressed, then if the V key is pressed. If these are both true, i then run my custom command. I also try to clear the clipboard (because a user would have put something in the clipboard to begin with if they tried to paste something), but what seems to happen is it runs my custom command, tried to empty the clipboard, but then continues to Paste the 'empty' data into the field on my form, thus clearing the field completely! The line Clipboard.SetDataObject(Ne
w DataObject) doesnt seem to actually clear the clipboard.
Does anyone know:
1) How i can completely override the Ctrl-V command in my application, so it doesnt paste and it only runs my defined code.
2) How to clear the clipboard, so when ctrl-V is pressed there is nothing to paste. Something similar to Excel's "Application.CutCopyMode = Fales" would be perfect.
If e.Control Then
If e.KeyCode = Keys.V Then
***RUN CUSTOM COMMAND HERE****