OnEditCommand:

codice:
Sub MyDataGrid_Edit(sender As Object, e As DataGridCommandEventArgs)
   MyDataGrid.EditItemIndex = e.Item.ItemIndex
   BindGrid()
End Sub 'MyDataGrid_Edit
OnUpdateCommand:

codice:
    Sub MyDataGrid_Update(sender As Object, e As DataGridCommandEventArgs)
        ' For bound columns the edited value is stored in a textbox,
        ' and the textbox is the 0th element in the column's cell
        Dim qtyText As TextBox = CType(e.Item.Cells(2).Controls(0), TextBox)
        Dim priceText As TextBox = CType(e.Item.Cells(3).Controls(0), TextBox)
        
        Dim item As String = e.Item.Cells(1).Text
        Dim qty As String = qtyText.Text
        Dim price As String = priceText.Text
        
        Dim dr As DataRow
        
        ' with a database, we'd use an update command.  Since we're using an in-memory
        ' DataTable, we'll delete the old row and replace it with a new one
        ' remove old entry
        CartView.RowFilter = "Item='" & item & "'"
        If CartView.Count > 0 Then
            CartView.Delete(0)
        End If
        CartView.RowFilter = ""
        
        ' add new entry
        dr = Cart.NewRow()
        dr(0) = qty
        dr(1) = item
        dr(2) = price
        Cart.Rows.Add(dr)
        
        MyDataGrid.EditItemIndex = - 1
        BindGrid()
    End Sub 'MyDataGrid_Update
Spudoratamente copiato dall'SDK