Ranorex

how can i select multiple row using index of listview

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
saurabh



Joined: 20 Jul 2007
Posts: 20
Location: India

PostPosted: Tue Aug 21, 2007 12:31 pm    Post subject: how can i select multiple row using index of listview
we can not select the two rows which have same text.Like if in a listview under a column ITEM there is row's text same like "item1" ,"item1" then i am unable to select both row together it will take only one row .So is there any facility so that i can select the row on the base of their index?Then i think confilction will not occure.So please tell me how can i select multiple row uniquely using index of listview.
_________________
Regards,
Saurabh Shrivastava
GE Global Research
Bangalore India
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
chall



Joined: 20 Aug 2007
Posts: 15

PostPosted: Tue Aug 21, 2007 10:33 pm    Post subject:
Perhaps you can do something like this:

int numOfItems = listView.ItemCount;
for (int i = 0; i < numOfItems; i++)
{
string itemName = listView.GetItemText(i, 0);
if (itemName.Equals("item1"))
{
listView.SelectItem(itemName);
}
}
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Tue Aug 21, 2007 11:33 pm    Post subject:
Or you can select all rows with the text "item1" as follows:

Code: click into code to enlarge
Element[] items = listView.Element.FindChildren(Role.ListItem,"item1");
foreach(Element item in items)
{
    item.Select(Selection.AddSelection);
}

Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
saurabh



Joined: 20 Jul 2007
Posts: 20
Location: India

PostPosted: Wed Aug 22, 2007 7:12 am    Post subject: I want to use Item index to select rows
I have used this approach,But my problem is different.Like I have 10 rows in ListView now I want to select 3rd,5th and 7th row from there.Now might be in 3rd and 5th row the value will be same for the Column ITEM like "item1" so in this case it will select only 5th and 7th row because we are using ITEM column as a unique key.My idea that I don't want to use any column as a unique In ListView there is ItemIndex which is starting form 0,1,2,3,4,5,6,7,8,9 for 10 rows I want to use this ItemIndex value to select rows.Becuase this would be always unique so there will be no confilction between two rows.I think now you can understand my problem.Please provide me solution for the same as soon as possible because its very critical.Thanks in Advance
_________________
Regards,
Saurabh Shrivastava
GE Global Research
Bangalore India
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Wed Aug 22, 2007 10:05 am    Post subject:
You can use index as follows:

Code: click into code to enlarge
// Read all items of the ListView
Element[] items = listView.Element.FindChildren(Role.ListItem);

// Select item with index 5 and 7
items[5].Select(Selection.AddSelection);
items[7].Select(Selection.AddSelection);


Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum