Disable copy paste in textbox
-
You may be able to do this by catching the keystrokes and rejecting them. I don't think there's a paste event. You would probably need to reset the clipboard after a CTRL-Insert or CTRL-C, b/c it's probably already done.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
hey you might be able to "catch" the event of(ctrl + c) and (ctrl + v) and not handle it... that might do the trick Hav fun
Harvey Saayman - South Africa Junior Developer .Net, C#, SQL think BIG and kick ASS
you.suck = (you.passion != Programming)
-
You may be able to do this by catching the keystrokes and rejecting them. I don't think there's a paste event. You would probably need to reset the clipboard after a CTRL-Insert or CTRL-C, b/c it's probably already done.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if(e.Control && e.KeyCode == Keys.C) { e.SuppressKeyPress = true; } else if(e.Control && e.KeyCode == Keys.V) { e.SuppressKeyPress = true; } } this is good, but i do't want to this code paste in all control. i want this code type only one time
-
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if(e.Control && e.KeyCode == Keys.C) { e.SuppressKeyPress = true; } else if(e.Control && e.KeyCode == Keys.V) { e.SuppressKeyPress = true; } } this is good, but i do't want to this code paste in all control. i want this code type only one time
-
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if(e.Control && e.KeyCode == Keys.C) { e.SuppressKeyPress = true; } else if(e.Control && e.KeyCode == Keys.V) { e.SuppressKeyPress = true; } } this is good, but i do't want to this code paste in all control. i want this code type only one time
Aside from the fact he probably shouldn't have just posted up this code as an instant solution (requiring the OP to do nothing for himself), the code only needs to be written once, you can bind one event to multiple controls.
He who makes a beast out of himself gets rid of the pain of being a man
-
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if(e.Control && e.KeyCode == Keys.C) { e.SuppressKeyPress = true; } else if(e.Control && e.KeyCode == Keys.V) { e.SuppressKeyPress = true; } } this is good, but i do't want to this code paste in all control. i want this code type only one time
What if the user copies or pasties using context menu of the textbox?
Giorgi Dalakishvili #region signature my articles #endregion
-
What if the user copies or pasties using context menu of the textbox?
Giorgi Dalakishvili #region signature my articles #endregion
-
I actually found a bug, where you can still get the context menu even when you do that. If i remember right, to get the context menu to STILL appear, you right-click the text box and hold the button down - move you mouse off of the text box - and then release the button. Then the normal menu appears :confused:
My current favourite word is: Bacon!
-SK Genius
-
I actually found a bug, where you can still get the context menu even when you do that. If i remember right, to get the context menu to STILL appear, you right-click the text box and hold the button down - move you mouse off of the text box - and then release the button. Then the normal menu appears :confused:
My current favourite word is: Bacon!
-SK Genius