My delete command for my datagrid isn't working. I am using the following code:
Dim strSubCatID As String = dgSubCat.DataKeys(e.Item.ItemIndex).ToString
Dim dr As DataRow
Dim i As Integer
For i = 0 To DsBudget.Tables("SubCat").Rows.Count - 1
dr = DsBudget.Tables("SubCat").Rows(i)
If dr(0) Is strSubCatID Then
dr.Delete()
Exit For
End If
Next
daSubCat.Update(DsBudget, "SubCat")
SetDS()
Any ideas? I've been working on this so long I can't think of anything else to try!! Thanks in advance.
Dim strSubCatID As String = dgSubCat.DataKeys(e.Item.ItemIndex).ToString
Dim dr As DataRow
Dim i As Integer
For i = 0 To DsBudget.Tables("SubCat").Rows.Count - 1
dr = DsBudget.Tables("SubCat").Rows(i)
If dr(0) Is strSubCatID Then
dr.Delete()
Exit For
End If
Next
daSubCat.Update(DsBudget, "SubCat")
SetDS()
Any ideas? I've been working on this so long I can't think of anything else to try!! Thanks in advance.