Hi all
In my VB6 app, I have a list box where I must select a specific item. The item is always the second to last item. I think it is something with itemcount -1, but I am not sure how the syntax is.
Anyone ?
Hi
you can do it with itemcount-1
but i suggest you to select with item text,
.select "text"
using above statement you need not worry at what index your item is.
Thanks
Hi Nilesh
If i use .select "text" my script is not dynamic. The items change names for each run, but not position.
Code:
GetROProperty("items count") 'Returns item count
.WebList("mylistSelect "#" & num1 -1
Try this code
Thanks
@Nilesh: Fyi, Janris issue was with "VbList" not the "WebList" and your solution works fine for WebList.
@janris: For VbList object, you can try with the below way.
Code:
ListItemCount=VbWindow("frmMain").VbWindow("...").VbList("...").GetItemsCount
VbWindow("frmMain").VbWindow("...").VbList("...").Select ListItemCount-2
Note: As the Items in VbList are stored from index "0" :
If we want to select Last item --> .Select ListItemCount-1
If we want to select
Second to Last item--> .Select ListItemCount-2
Hope this would solve your issue.
Hi Janriss,
Whether you try to lake the value with the help of Index property.
Thanks'
Mahesh