Click TextBox and go to the event properties. Scroll down, you will see, "IsKeyDown" property. Double click or enter into it. Then give your logic there. ex: if(e.KeyCode==Keys.D1) { TextBox1.text = string.empty; }