When I add a new row to a datagridview, I am able to add data to a cell, but when I go to the row with the mouse the data disappears out of the cell. What code is needed to get the data to stay?
Private Sub BindingNavigatorAddNewItem_Click(sender As System.Object, e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
' When a new row is entered add Site id.
Dim rRow As Integer = 0
rRow = dgvEstimator2.NewRowIndex
'' Set Job Site ID
If IsDBNull(Me.dgvEstimator2(1, rRow).Value) Or IsNothing(Me.dgvEstimator2(1, rRow).Value) Then
Me.dgvEstimator2(1, rRow).Value = rJobsiteID
' .Rows(DGVRow).Cells(1).Value = objSheet.Cells(excelRow, 1).value
Me.dgvEstimator2.Rows(rRow).Cells(1).Value = rJobsiteID
' Me.dgvEstimator2.Rows(rRow).Cells(1).Selected = True
'dataGridView1.Rows[Rowindex].Selected = true
Me.dgvEstimator2.Rows(rRow).Selected = True
' dgvEstimator2.Rows(rRow).SetValues()
dgvEstimator2.CommitEdit(DataGridViewDataErrorContexts.Commit)
End If
end sub
Thanks in advance!