Forum Discussion

srikanthmaddhi's avatar
srikanthmaddhi
New Contributor
13 years ago

How to compare values in wpf listview values with Excel sheet

Please help on the following scenario,How to compare each value in wpf list view with values stored in excel sheet.
  • Anonymous's avatar
    Anonymous

    Hi Maddhi,



    You can write your own comparison function that will iterate through all records in the list view and compare it with data stored in an Excel file. The function can look like this:



    var control =...// obtain the list view control

    var excel=...//initialize the Excel object

    for (int i=0;i<control.wItemCount;i++)

    {

      if (control.wItem(i)==excel.Cells(i,0)

       {

           // the items are equal

       }

    }





    Please refer to the "Working With Microsoft Excel Files" article to choose the most convenient way to work with Excel files.