views:

556

answers:

1

VS 2008 in vb.NET

Hi,

I have a manually created a dataset (dsPickingList) that I add data too as the user inputs data on a form. There is a datagridview on my form of which it's datasource is set to dsPickingList.

What I would like to do is spot if a user deleteds a row from the datagridview and update the dataset (dsPickingList) as it is ultimatly this dataset that is stored to the db and printed, not the DataGridView.

The code I have at the moment is:

Code:

Private Sub DGV1_UserDeletedRow(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowEventArgs) Handles DGV1.UserDeletedRow

    If DGV1.RowCount = 0 Then
        Shortfall = False
        Exit Sub
    End If

    For Each row As DataRow In dsPickingList.Tables("ProductsRequired").Rows
        If row("ShortFall") < 0 Then
            Shortfall = True
            Exit For
        End If
    Next

End Sub

This is why I need the action from the DataGridView to update the dataset.

I hope you understand my needs and I thank you in advance.

A: 

The answer is end the edit on the data grid view to end the editing which in turn updates the dataset.

DGV1.EndEdit

Paul.