-
Notifications
You must be signed in to change notification settings - Fork 2
/
Module1.vb
22 lines (19 loc) · 1.27 KB
/
Module1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Imports System.Windows.Forms
Module Module1
<System.Runtime.CompilerServices.Extension> _
Public Sub ChangeEditModeToOnPropertyChanged(gv As DataGridView)
AddHandler gv.CurrentCellDirtyStateChanged, Function(sender, args)
gv.CommitEdit(DataGridViewDataErrorContexts.Commit)
If gv.CurrentCell Is Nothing Then
Return Nothing
End If
If gv.CurrentCell.EditType <> GetType(DataGridViewTextBoxEditingControl) Then
Return Nothing
End If
gv.BeginEdit(False)
Dim textBox = DirectCast(gv.EditingControl, TextBox)
textBox.SelectionStart = textBox.Text.Length
Return Nothing
End Function
End Sub
End Module