M
michaeldcummings
I have been reading a bunch of posts about how to delete rows from a
dataset and have yet to find an answer that doesnt also have something
to do with using datagrids.
I am just trying to remove a row from a dataset that I have, but I cant
figure out how to get the row index value so that I can call:
DS.Tables("table").Rows(row).Delete()
how do I get the value of "row"?? it seems like there should be a very
simple call to get the index but I cant find one...
Here is generally what I am trying do do...
'----------------------------------------------------------------
Private Sub btnDel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDel.Click
Dim dr As DataRow
Dim row As Integer
Try
If radExisting.Checked = True Then
For Each dr In cattlelistDS.Tables("AnimalList").Rows
If dr("Animal") = lstList.SelectedItem Then
'get the row index
row = ???????
cattlelistDS.Tables("animallist").Rows(row).Delete()
End If
Next
End If
lstList.Items.Remove(lstList.SelectedItem)
lblCount.Text = "Animals: " & lstList.Items.Count
Catch
Exit Sub
End Try
End Sub
'----------------------------------------------------------------
Thanks for any help
~Mike
dataset and have yet to find an answer that doesnt also have something
to do with using datagrids.
I am just trying to remove a row from a dataset that I have, but I cant
figure out how to get the row index value so that I can call:
DS.Tables("table").Rows(row).Delete()
how do I get the value of "row"?? it seems like there should be a very
simple call to get the index but I cant find one...
Here is generally what I am trying do do...
'----------------------------------------------------------------
Private Sub btnDel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDel.Click
Dim dr As DataRow
Dim row As Integer
Try
If radExisting.Checked = True Then
For Each dr In cattlelistDS.Tables("AnimalList").Rows
If dr("Animal") = lstList.SelectedItem Then
'get the row index
row = ???????
cattlelistDS.Tables("animallist").Rows(row).Delete()
End If
Next
End If
lstList.Items.Remove(lstList.SelectedItem)
lblCount.Text = "Animals: " & lstList.Items.Count
Catch
Exit Sub
End Try
End Sub
'----------------------------------------------------------------
Thanks for any help
~Mike