Vb.net 在vb formdesigner中如何从datagridview更新参考底图表

Vb.net 在vb formdesigner中如何从datagridview更新参考底图表,vb.net,visual-studio-2015,datagridview,Vb.net,Visual Studio 2015,Datagridview,我有一个绑定到SQLServerDB的datagridview。在单元格中进行某些更改后,我可以使用按钮将更改保存到数据库中: Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click Try Dim dlgResult As New DialogResult dlgResult = MessageBox.Show("Do you wa

我有一个绑定到SQLServerDB的datagridview。在单元格中进行某些更改后,我可以使用按钮将更改保存到数据库中:

    Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click
    Try
        Dim dlgResult As New DialogResult
        dlgResult = MessageBox.Show("Do you want to save the changes you made ?", "Confirmation !", MessageBoxButtons.YesNo)
        If dlgResult = DialogResult.Yes Then
            Try
                Me.tblInvoicesTableAdapter.Update(Me.dsInvoices.tblInvoices)
                MessageBox.Show("Updated successfully !", "Information :", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
        Else
            MessageBox.Show("Update canceld !", "Information :", MessageBoxButtons.OK, MessageBoxIcon.Information)

            'Code for undo changes to dgv

            'some testcode - doesn't work
            Me.dgvInvoice.RefreshEdit()
            Me.dgvInvoice.Refresh()
            End If
  Catch ex As Exception
        MessageBox.Show("Error\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try
End Sub

如何重置我的
按钮的
Else
语句中的更改?单击
事件?

使用
数据表作为
数据源,您只需调用。根据MSDN文件,此方法:

回滚自加载表或上次调用表以来对表所做的所有更改


使用
数据表
作为
数据源
,您只需调用。根据MSDN文件,此方法:

回滚自加载表或上次调用表以来对表所做的所有更改


谢谢,解决方案很好用!谢谢,解决方案很好用!