Listview Subitems

Experiences, small talk, and other automation gossip.
FabianM
Posts: 2
Joined: Thu Aug 16, 2012 4:39 pm

Listview Subitems

Post by FabianM » Thu Aug 16, 2012 6:09 pm

Hi,

I've used the search function but i only found old topics and they didn't really help me.

I'm using Ranorex Studio 3.2.15734

I have an .NET Desktop Application (Framework 4.0).
In this App I've an listview(.Net Listview) and i would like to access the subitems of the listview items.

When I do this:

foreach (ListItem myitem in myListview.Items)
{

}

I only get the First Column Information. I need the Information of the Third Column. I tried, but I didn't find any subitems Properties.
In C# now i would loop trough "myitem" and check for specific Text.

Any suggestions what I'm doing wrong? If you know a Workaround it also would be ok ;)

With regards,
Fabian

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Listview Subitems

Post by Support Team » Fri Aug 17, 2012 10:43 am

Hi Fabian,

Please take a look at the following forum post, it could be helpful: forum post.

In order to analyze the issue in detail we would also need a Ranorex Snapshot file of your application when it is in the same state as it would be when you would execute the specific code.
Following link will show you how to generate a snapshot file:
Creating Ranorex Snapshot Files.

Regards,
Markus
Ranorex Support Team

FabianM
Posts: 2
Joined: Thu Aug 16, 2012 4:39 pm

Re: Listview Subitems

Post by FabianM » Fri Aug 17, 2012 11:32 am

Hi,

this is my Solution and it works!
The IList things didn't work. I recognized in Spy that there is a Table and with that Table it works fine.

Code: Select all

bool Gefunden = false;
        	Table table = "/form[@controlname='FrmMain']/container[@controlname='panContentDummy']/container[@controlname='navUserMainFrameUserContainer']/container[@controlname='userStueckliste1']/container/table[@controlname='lvListe']";
        	Column SpalteArtikelnummer = table.Columns[2];
        	
        	foreach(Cell zelle in SpalteArtikelnummer.Cells)
        	{
        		if (zelle.Text == "169007-164") 
        		{
        				Gefunden = true;
        		}
        	}	
        	if (Gefunden) 
        	{
        		Report.Success("Erforderliche Artikelnummer 169007-164 war vorhanden");
        	}
        	else
        	{
        		Report.Warn("Erforderliche Artikelnummer 169007-164 war nicht vorhanden");
        	}

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Listview Subitems

Post by Support Team » Fri Aug 17, 2012 12:32 pm

Hi,

I am glad to hear that you were able to find a solution :).

Regards,
Markus
Ranorex Support Team