I’m working on a Form that contains a datagridview and textbox, I need the datagridview detect any letter of the alphabet or numbers, then select the input and send the key pressed to input.
I can not find any solution for this, thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You will need to attach an event handler to the cell editing control that is receiving the data that will respond to the KeyPress event. This can be done by handling the EditingControlShowing event.
Here is some basic code that does this:
There are other events that you can respond to such as KeyDown but KeyPress is generally preferred since it gives you a Char with the event args. With events like KeyDown you will have KeyCodes instead, which don’t allow you to easily tell if the input was upper or lower case.