From: Dan Paulovich on
Hello All

I'm using VB.net Express 2008. I am working on an application
that has a form with a data bound DataGridView. I want to be
able to select a cell and delete rows starting with the row selected
until a particular text is encountered. The logic below works fine
deleting the corect rows in the dataset but does not alter the
MSAccess database. I use similar logic to add data/rows and that
works fine, updating the database. Any help will be greatly appreciated.
I have the dtatbase "Copy to Output Directory" property set to "DO not copy"
The following is the code I'm using:
DG3Strng = FoodDatabaseDataSet.Meals.Rows(DelRowIndex).Item(0).ToString

If InStr(DG3Strng, "Breakfast") = 1 Or InStr(DG3Strng, "Lunch") = 1 Or InStr(DG3Strng, "Dinner") Or
InStr(DG3Strng, "Snack") = 1 Then

Do Until DG3Strng = "Percent Daily Value"

DG3Strng = FoodDatabaseDataSet.Meals.Rows(DelRowIndex).Item(0).ToString

FoodDatabaseDataSet.Meals.Rows.RemoveAt(DelRowIndex)

Loop

FoodDatabaseDataSet.Meals.Rows.RemoveAt(DelRowIndex)

Me.MealsBindingSource.EndEdit()

Try

Me.MealsTableAdapter.Update(Me.FoodDatabaseDataSet.Meals)

FoodDatabaseDataSet.Meals.AcceptChanges()

Catch ex As Exception

End Try

End If