Disable delete button on RichTextBox WF

前端 未结 5 785
无人及你
无人及你 2021-01-14 20:36

I am trying to disable people from deleting a textbox in a richtextbox. The project is using windows form.

Here is the code I have:

    private void         


        
5条回答
  •  有刺的猬
    2021-01-14 21:05

    Per the MSDN documentation on KeyPressEventArgs.KeyChar, you cannot get or set the DELETE key using that event. You will need to use the KeyEventArgs.KeyCode instead, subscribing to the KeyDown and KeyUp events.

提交回复
热议问题