Jess31
asked on
DataGridView / BeginEdit(True) ?
Using vb.net/winform and DataGridView. On the CellEnter event I have BeginEdit(True). This is fine. Only that the cursor is placed at the end of whatever text exists. I would like to have the cursor either at the beginning of the text or for the entire text to be selected and whatever is typed erases it. How can I do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Private WithEvents thiscontrol as control
Private Sub Me.DataGridView_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles Me.DataGridView.EditingControlShowing
Try
If DataGridView.CurrentCell.ColumnIndex = "YourColumnIndex Then
thiscontrol = CType(e.Control, TextBox)
thiscontrol.SelectionStart=0
Else
thiscontrol = Nothing
End If
Do you not see the entire text being selected when clicking the cell? If so, you may have other event(s) which removes the selection.