Q:

Column Name already belongs to datatable

I try to copy from one gridview to another gridview 
i try this 
 Dim dt As New DataTable()

    For Each cell As TableCell In GridView1.HeaderRow.Cells
        dt.Columns.Add(cell.Text)
    Next

    For Each row As GridViewRow In GridView1.Rows
        dt.Rows.Add()
        For i As Integer = 0 To row.Cells.Count - 1
            dt.Rows(row.RowIndex)(i) = row.Cells(i).Text

        Next
    Next

    GridView2.DataSource = dt
    GridView2.DataBind()

but this shows an error 
A column named 'Amount' already belongs to this DataTable.

where as i SP i don't have duplicate columns 

A:

You have commented that you really have two header-cells with the same text "Amount". You cant add two columns with the same name to a DataTable, so you have to assign a different name or let it generate automatically, f.e. Amount_2, Amount_3,...:
This version that uses Substring and LastIndexOf handles also the case that the column-name could contain underscores:
For Each cell In tableCells
    Dim colName = cell
    While dt.Columns.Contains(colName)
        Dim lastUnderscoreIndex = colName.LastIndexOf("_"c)
        Dim colNameWithoutNum = If(lastUnderscoreIndex > -1, colName.Remove(lastUnderscoreIndex), colName)
        Dim numPart = If(lastUnderscoreIndex > -1, colName.Substring(lastUnderscoreIndex + 1), "")
        Dim num As Int32 = If(Int32.TryParse(numPart, num), num + 1, 2)
        colName = $"{colNameWithoutNum}_{num}"
    End While
    dt.Columns.Add(colName)
Next

