FlexSheet for WPF | ComponentOne
Working with C1FlexSheet / Sheet Operations / Removing Duplicate Rows
In This Topic
    Removing Duplicate Rows
    In This Topic

    When you work with large amount of data in a sheet, you might encounter duplicate rows or might accidentally copy few rows unknowingly. In this situation, finding and deleting such duplicate rows can be time-consuming. To get out of this situation, you can use the RemoveDuplicates method in C1FlexSheet control.

    RemoveDuplicates method is used in C1FlexSheet to remove rows that consist of same data. The following lines of code illustrate removing duplicate rows in the selected columns:

    Dim selectedColumns As New List(Of Integer)()
    For i As Integer = flex.Selection.LeftColumn To flex.Selection.RightColumn
        selectedColumns.Add(i)
    Next
    flex.RemoveDuplicates(flex.Selection, selectedColumns)
    
    List<int> selectedColumns = new List<int>();
    for (int i = flex.Selection.LeftColumn; i <= flex.Selection.RightColumn; i++)
    {
        selectedColumns.Add(i);
    }
    flex.RemoveDuplicates(flex.Selection, selectedColumns);