I have a windows application in which I am going to delete a datarow from a datatable.
But I got an exception.

> 
> The given DataRow is not in the current DataRowCollection.
> 
> 
> 

The code:

```
DataTable dt = new DataTable();
DataRowView currentDataRowView = (DataRowView)DataGridView1.CurrentRow.DataBoundItem;
DataRow row = currentDataRowView.Row;

dt.Rows.Remove(row); // exception here.
DataGridView1.DataSource = dt;

```

The datatable dt's information as the image shown.
![datatable dt](https://i.stack.imgur.com/j0iU8.png)

I think that I already have casted datarowview to datarow.

**EDIT:**
dt was created from another DataGridView.

```
                foreach (DataGridViewRow row in DatGridView2.Rows)
                {
                    DataGridViewCheckBoxCell check = row.Cells[0] as DataGridViewCheckBoxCell;
                    if (check.Value != null)
                    {
                        if ((bool)check.Value)
                        {
                            //this row has a checkBox set to true (tick is added)
                            //add this row to dataTable ...
                            DataRow myRow = (row.DataBoundItem as DataRowView).Row;
                            DataRow dr = dt.NewRow();
                            dr[0] = myRow[0];
                            dr[1] = myRow[1];
                            dr[2] = myRow[2];
                            dr[3] = myRow[3];
                            if (!dt.Rows.Contains(dr[0]))
                            {
                                dt.Rows.Add(dr);
                            }
                        }
                    }

```