I think the reason the OPs code does not work is because once you call Remove you are changing the Length of drr. When you call Delete you are not actually deleting the row until AcceptChanges is called. This is why if you want to use Remove you need a separate loop.
Depending on the situation or preference...
string colName = "colName";
string comparisonValue = (whatever it is).ToString();
string strFilter = (dtbl.Columns[colName].DataType == typeof(string)) ? "[" + colName + "]='" + comparisonValue + "'" : "[" + colName + "]=" + comparisonValue;
string strSort = "";
DataRow[] drows = dtbl.Select(strFilter, strSort, DataViewRowState.CurrentRows);
Above used for next two examples
foreach(DataRow drow in drows)
{
drow.Delete();//Mark a row for deletion.
}
dtbl.AcceptChanges();
OR
foreach(DataRow drow in drows)
{
dtbl.Rows[dtbl.Rows.IndexOf(drow)].Delete();//Mark a row for deletion.
}
dtbl.AcceptChanges();
OR
List<DataRow> listRowsToDelete = new List<DataRow>();
foreach(DataRow drow in dtbl.Rows)
{
if(condition to delete)
{
listRowsToDelete.Add(drow);
}
}
foreach(DataRow drowToDelete in listRowsToDelete)
{
dtbl.Rows.Remove(drowToDelete);// Calling Remove is the same as calling Delete and then calling AcceptChanges
}
Note that if you call Delete() then you should call AcceptChanges() but if you call Remove() then AcceptChanges() is not necessary.