All pastes #754176 Raw Edit

Someone

public text v1 · immutable
#754176 ·published 2007-10-29 21:00 UTC
rendered paste body
If IsNothing(TestDataSet1) Then Exit Sub

        'prompt to save changes
        If MsgBox("OK to delete?", MsgBoxStyle.OkCancel, "Confirm Delete") = MsgBoxResult.Ok Then
            'delete it from the dataset
            TestDataSet1.Eggs.Rows.RemoveAt(ListBox1.SelectedValue - 1)
            EggsTableAdapter1.Update(TestDataSet1)
        End If


' this doesn't seem to be working

' i have a listbox bound to datasource, display member "nick" and value member "ID" where id is the primary key starting at 1....
' this asks for the index of the row which starts at 0, so i - 1 from the selected value "ID" to give the correct index #.
' i'm not sure but this just isn't deleting the row from the database ....