Is there a way to make text inside a DataGridViewTextBoxCell select (highlight) at the start of the cell edit? I’ve noticed if I select the text in another cell it will continue to select in subsequent cells I click in. If you put the cursor in the middle of the value, it will place the cursor in the middle of subsequent cells as you click or arrow through them. It’s like it’s remembering the previous cursor condition and trying to maintain it. I’d like to just auto-select all the text on enter, so the user can enter a new value “on top” of the existing.
One additional note, if someone else ever stumbles on this. The downside of changing the field input type to text was that on mobile devices it now brings up the keyboard when you click in the field, instead of the number pad. But after reading the link Luca provided, I decided to try “Tel” as the input type, and now get both the select all and the number pad when the cell goes in to edit mode.
Thanks again for the help!
InputType.Number doesn’t support text selection in the browser: https://html.spec.whatwg.org/multipage/input.html#do-not-apply
I tried in a small sample with standard text fields and tabbing does select the full text.
Yes sir, it is set to EditOnEnter currently. I also tried firing dataGridView.BeginEdit(true) from the cell enter event. I tried using beginEdit with different edit modes on the grid. None of these attempts worked.
If it’s at all relevant, I have the input type on the cellTextBox set to numeric.
Please login first to submit.