demausdauth
Well-known member
VS2005 SP1
I have a datatable that is not created from a database, in other words i have created the columns and added them to a datatable object. Then I fill the rows and add them to the datatable. Now i need to delete some of the rows but not others.
One would think this would work and it is the most common solution that I have found in searching. This will however error out on the 'Next' with IndexOutOfRange exception.
Did I miss something. Anybody got any ideas out there?
I have a datatable that is not created from a database, in other words i have created the columns and added them to a datatable object. Then I fill the rows and add them to the datatable. Now i need to delete some of the rows but not others.
VB.NET:
For Each drCheck As DataRow In dtAttach.Rows
If Not drCheck("AttachType").ToString.ToUpper = "A" AndAlso My.Computer.FileSystem.FileExists(drCheck("PathName") & "\" & drCheck("Attachment")) Then
'file is not attachtype 'A' and it exsists in the acordforms directory
My.Computer.FileSystem.DeleteFile(drCheck("PathName") & "\" & drCheck("Attachment"), FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently)
drCheck.Delete()
End If
Next
dtAttach.AcceptChanges()
One would think this would work and it is the most common solution that I have found in searching. This will however error out on the 'Next' with IndexOutOfRange exception.
Did I miss something. Anybody got any ideas out there?