Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting second to last item of a list box
#1
Not Solved
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 ?
Reply
#2
Not Solved
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
Reply
#3
Not Solved
Hi Nilesh

If i use .select "text" my script is not dynamic. The items change names for each run, but not position.
Reply
#4
Not Solved
Code:
GetROProperty("items count") 'Returns item count
.WebList("mylistSelect  "#" & num1 -1


Try this code


Thanks
Reply
#5
Not Solved
@Nilesh: Fyi, Janris issue was with "VbList" not the "WebList" and your solution works fine for WebList.Smile

@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.Smile
Reply
#6
Not Solved
Hi Janriss,

Whether you try to lake the value with the help of Index property.

Thanks'
Mahesh
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 1,696 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  How to select item within WebMenu learnasugo 4 8,085 10-11-2016, 03:35 PM
Last Post: learnasugo
  Compare second web list value according to the first web list value roselin6 1 2,823 10-07-2015, 09:14 PM
Last Post: supputuri
  Searching for and selecting row in Datawindow zsl0009 0 2,792 08-04-2015, 01:02 AM
Last Post: zsl0009
  Problem selecting in a dropdown menu during playback. qemls29 9 12,997 07-28-2015, 05:44 PM
Last Post: Sharan

Forum Jump:


Users browsing this thread: 1 Guest(s)