I Have a question about a winform:
I need the selection start and length of textboxcell.
As it is now i always get the start and length of a previous edit (eg. the values are one edit behind the latest edit).
`Private Sub oParams_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles oParams.EditingControlShowing
If TypeOf e.Control Is DataGridViewTextBoxEditingControl Then
Dim tbec As DataGridViewTextBoxEditingControl = CType(e.Control, DataGridViewTextBoxEditingControl)
Dim cellText As String = tbec.Text
selCellSt = tbec.SelectionStart
selCellLen = tbec.SelectionLength
'MsgBox("start: " & tbec.SelectionStart & vbNewLine & "Length: " & tbec.SelectionLength)
End If
End Sub`
When the button is pressed i use this:
Private Sub oParams_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles oParams.CellContentClick If e.ColumnIndex = 4 Then MsgBox("sel start: " & selCellSt & vbNewLine & "sel lenght: " & selCellLen) end if
Does anyone have a solution so it gets the values of the latest selection ?
Video as reference to wht i mean:
https://youtu.be/mcKWuyA66aA
thank you in advance
Loïc Van Wetter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.