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

Where should I place this code so that is run when the user presses Enter in a cell on the Insert Bar?

I found that if I declare withevents then the event is available and it works  (Private WithEvents m_insertionRow As Xceed.Grid.InsertionRow)

But how can I also set the cell to the one the user was entering into?  I tried the following but it puts me back to the insert row.

   Private Sub m_insertionRow_EditEnded(ByVal sender As Object, ByVal e As System.EventArgs) Handles m_insertionRow.EditEnded
      GridControl1.DataRows(GridControl1.DataRows.Count – 1).CanBeCurrent = True
      Dim cCell As Cell = GridControl1.CurrentCell
      GridControl1.CurrentRow = GridControl1.DataRows(GridControl1.DataRows.Count – 1)
      GridControl1.CurrentCell = cCell
   End Sub

I have also tried the following but the CurrentCell always seems to be the first cell in the grid.

      Dim ss As String = GridControl1.CurrentCell.AccessibleName
      GridControl1.CurrentRow = GridControl1.DataRows(GridControl1.DataRows.Count – 1)
      GridControl1.CurrentCell = GridControl1.DataRows(GridControl1.DataRows.Count – 1).Cells(ss)
 

 

 

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