DataGridView -Value does not gets saved if selection is not lost from a cell

前端 未结 6 868
暖寄归人
暖寄归人 2020-12-16 03:53

I am using the DataGridView Control for reading and writing an XML file through XML Serialization.

I have an issue as explained below:

  1. I read an XML fi
6条回答
  •  鱼传尺愫
    2020-12-16 04:24

    OK, this is UGLY but it works to get the FINAL CHANGES from the grid WITHOUT having to move to another row:

    With DataGridView1
        .DataSource = Nothing
        .DataSource = gridDataTable
        Dim changedFoo As DataTable = gridDataTable.GetChanges
    End With
    

    However I still like the answer from Amit Karmakar the best. I've added the 'DataGridView1.CurrentCell = Nothing' to the DataGridView1 LostFocus event.

提交回复
热议问题