DataGridView CellBeginEdit question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seraieis
    New Member
    • Apr 2008
    • 60

    DataGridView CellBeginEdit question

    I'm having problems with DGV's in .NET when it comes to saving information from the view. If the user has been entering information into the record (i.e. CellBeginEdit has been raised, but not CellEndEdit yet) and then saves the record, the changes made to the row will not be saved, because they haven't clicked off the row.

    Short of creating a global variable and updating it, is there a property I can check to see if the user is currently editing the row, then force that row to update the view, so it can be saved to a file?

    I'm trying to avoid doing this:
    Code:
        private g_bRowEditing as Boolean = False
        Private Sub dgvStructureDataGrid_CellBeginEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellCancelEventArgs) Handles dgvStructureDataGrid.CellBeginEdit
            bRowEditing = True
        End Sub
        Private Sub dgvStructureDataGrid_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvStructureDataGrid.CellEndEdit
            bRowEditing = False
        End Sub
    Any help would be greatly appreciated!
  • seraieis
    New Member
    • Apr 2008
    • 60

    #2
    Of course, after I post here, I would figure it out :)

    Code:
        dgv.ClearSelection()
        dgv.Rows(dgv.RowCount - 1).Selected = True

    Comment

    Working...