disable delete key

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
i have a richtextbox and i want to prevent the user from deleting its
contents by using the delete key (keys.delete). How can this be achieved ? (
i guess the same would apply for textbox or combobox controls)

thx;)
 
How about making it readonly? Use the RichTextBox.ReadOnly propery.

hi,
i have a richtextbox and i want to prevent the user from deleting its
contents by using the delete key (keys.delete). How can this be achieved ? (
i guess the same would apply for textbox or combobox controls)

thx;)
 
private void richTextBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e) {

if(e.KeyValue == 46)e.Handled = true;

}
 
Private sub richTextbox1_Keydown (byval sender as object, byval e as
System.Windows.Forms.KeyEventArgs)
if e.KeyValue = 46 then
e.Handles = true
end if

Only translated nothing added or deleted
:-)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top