Home Forums WinForms controls Xceed Grid for WinForms Inserting a row using the Insert row causes frustration for the user. Reply To: Inserting a row using the Insert row causes frustration for the user.

User (Old forums)
Member
Post count: 23064

I found the solution. It may not be the best but it works.

Declare a module level variable to capture the AccessibleName of the column being edited:

Private mInsertColName As String = “”

   Private Sub m_insertionRow_EndingEdit(ByVal sender As Object, ByVal e
As System.ComponentModel.CancelEventArgs) Handles
m_insertionRow.EndingEdit
      mInsertColName = GridControl1.CurrentCell.AccessibleName
   End Sub 

   Private Sub m_insertionRow_EditEnded(ByVal sender As Object, ByVal e As System.EventArgs) Handles m_insertionRow.EditEnded
      GridControl1.CurrentRow = GridControl1.DataRows(GridControl1.DataRows.Count – 1)
      GridControl1.CurrentCell = GridControl1.DataRows(GridControl1.DataRows.Count – 1).Cells(mInsertColName)
   End Sub

Imported from legacy forums. Posted by Morgan (had 917 views)