Forum Discussion

martin_home's avatar
martin_home
Occasional Contributor
7 years ago
Solved

Searching for Text in a Windows ListView

I am using keyword tests. I am running a Windows App. I have a List and I want to search for a specific Lab No e.g. 18B000025. Can anybody suggest a .Method I can use. I have trawled through the list to no avail

 

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    If this is a standard ListView control type, the various properties and methods available can be found at https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/desktop/win32/list-view/index.html

     

    Although, this looks less like a ListView and more like a grid of some sort...

    https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/grids/basic-concepts.html gives you some starting points.

    Depending upon what the control is and what properties/methods/etc are available on the control, the methodology may vary.  What I've done for searching many grid types is simply a for loop from 0 to grid.RowCount, checking the value of column 0 on each row... if I find the desired lab value, I store the rowindex for that lab in a variable and break out of the for loop.

     

    But... for the specifics of YOUR control, can you give us a screenshot of what the grid shows up as in the Object Browser or Object Spy, being sure to include as many properties and methods available under "Advanced"...  

    • martin_home's avatar
      martin_home
      Occasional Contributor

      Thanks for the help and suggestions.

      You were right it is a GRID not a LIST

       

      But it is not a standard Grid and I had to add the classname to the  Object Mapping Properties of the Project before it was recognised as a Grid.

       

      The classname was DataGridViewRichTextBox.SelectDataGridView added under  the tree

      Microsoft Controls

            WinForms

                  DataGridView 

       

       

       

      I am now able to use the methods I would expect with a Grid.

       

      Hooray.

       

      Cheers