| View previous topic :: View next topic |
| Author |
Message |
saurabh
Joined: 20 Jul 2007 Posts: 20 Location: India
|
Posted: 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 |
|
 |
chall
Joined: 20 Aug 2007 Posts: 15
|
Posted: 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 |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: 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 |
|
 |
saurabh
Joined: 20 Jul 2007 Posts: 20 Location: India
|
Posted: 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 |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: 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 |
|
 |
|