try with LINQ
dt_Barcode = dt_Barcode.AsEnumerable()
.GroupBy(r => new { Itemid = r.Field<int>("Itemid"), PacktypeId = r.Field<int>("PacktypeId")})
.Select(g => g.First())
.CopyToDataTable();
Sample Test Code:
void Main()
{
DataTable dt_Barcode =GetTable();
dt_Barcode = dt_Barcode.AsEnumerable()
.GroupBy(r => new { Itemid = r.Field<int>("Itemid"), PacktypeId = r.Field<int>("PacktypeId")})
.Select(g => g.First())
.CopyToDataTable();
}
DataTable GetTable()
{
DataTable table = new DataTable();
table.Columns.Add("Barcode", typeof(int));
table.Columns.Add("Itemid", typeof(int));
table.Columns.Add("PacktypeId", typeof(int));
table.Rows.Add(1,100,1);
table.Rows.Add(1,100,2);
table.Rows.Add(1,100,3);
table.Rows.Add(1,100,1);
table.Rows.Add(1,100,3);
return table;
}