469,323 Members | 1,575 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

disable delete key

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;)
Nov 21 '05 #1
5 9027
How about making it readonly? Use the RichTextBox.ReadOnly propery.

"juststarter" <ju*********@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
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;)
Nov 21 '05 #2
private void richTextBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e) {

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

}
--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"juststarter" <ju*********@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
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;)

Nov 21 '05 #3
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
private void richTextBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e) {

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

}
--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"juststarter" <ju*********@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
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;)


Nov 21 '05 #4
Thanks Cor ;-) I forgot this was the VB Group.

--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Cor Ligthert" <no************@planet.nl> wrote in message
news:eN**************@tk2msftngp13.phx.gbl...
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
private void richTextBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e) {

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

}
--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"juststarter" <ju*********@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
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;)



Nov 21 '05 #5
thx guys ;-)

"W.G. Ryan eMVP" wrote:
Thanks Cor ;-) I forgot this was the VB Group.

--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Cor Ligthert" <no************@planet.nl> wrote in message
news:eN**************@tk2msftngp13.phx.gbl...
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
private void richTextBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e) {

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

}
--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"juststarter" <ju*********@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
> 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;)



Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by ziad dodin | last post: by
4 posts views Thread by Brad | last post: by
1 post views Thread by Geroge D. Lake | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.