By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 2,954 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

Disable Ctrl + Insert on Windows Forms

P: n/a
Hi all,

Is there any way to disable copy & paste options using ctrl + Insert &
Shift + Insert respectively on Windows forms using C#.

Kindly Help !!

Regards
Sumit Vohra

Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You should be able to do this if you override the ProcessCmdKey method.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Sumit" <vo********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi all,

Is there any way to disable copy & paste options using ctrl + Insert &
Shift + Insert respectively on Windows forms using C#.

Kindly Help !!

Regards
Sumit Vohra

Nov 17 '05 #2

P: n/a
Set the form's KeyPreview property to True, then add a handler for the
KeyDown event as follows:

private void Form1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e) {
if (e.KeyCode == Keys.Insert && (e.Shift || e.Control))
e.Handled = true;
}

If you want to totally disable copy and paste you should also check for
Ctrl-C and Ctrl-V.

Chris Jobson

"Sumit" <vo********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi all,

Is there any way to disable copy & paste options using ctrl + Insert &
Shift + Insert respectively on Windows forms using C#.

Kindly Help !!

Regards
Sumit Vohra

Nov 17 '05 #3

P: n/a
Thanks Chris/Bob,

It worked well :-)

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.