Ask a Question

Searching for Text in a Windows ListView

SOLVED
martin_home
Occasional Contributor

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

 

ListView_SearchForlabNo.png

2 REPLIES 2
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-v...

 

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"...  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
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

cancel
Showing results for 
Search instead for 
Did you mean: