Let's say i have a listbox which i add the items using THISFORM.list1.AddItem(<value>). Then i would like to modify the DisplayValue of the 3rd Item in the list? How would i do that? DO i need to pass the ListIndex?
When you call AddItem, you can optionally specify the nIndex; if you do that, you'll naturally know the index of the item you just added. You can also grab the index of the last added item with the List.NewIndex property. [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href=
Thanks for replying. However i am still facing the problem of manually changing the display value of the 3rd (or another) item.
Eg, I have a Textbox, command button and a listbox on my form. The listbox currently consist of 5 items, all using the additems method.
Let's say i type 'TEST' in the textbox and then select the 3rd item in the listbox, and when i click the command button i want to change the current displayvalue of the item in the list box to 'TEST'.
How do i reference that?
Should it be something like
Errr...uhhh....this is one of those things where you initially say of course you can do that, but then after investigation you find that, if you can do it, I have no idea how.
The clue was running the form, then opening our trusty Swiss Army (tm) Debugger and putting _screen.activeform in the Watch window. Expanding _screen.activeform, then .List1, we see the absence of any "controls" type collection or array. For an example of what I was looking for, run a form that has a grid, then look in the debugger's Watch window under the grid and you'll see lots of "+" expandable controls collections.
So Yue, my only advice is to work around it: make the RowSource for the list an array, and simply change that array element's contents and refresh the List. [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href=
I don't think there's a way to manually change the displayvalue of an item in a listbox if the item was added using the additem method in the first place. I guess i'll be using an array Thanks again robert
If you dont mind me asking, why are trying to avoid the RemoveItem/AddItem method?
WITH THISFORM
.LockScreen = .T. && if you're worried the user will see a flicker
lnIndex = .MyListBox.ListIndex
.MyListBox.RemoveItem(lnIndex)
.MyListBox.AddItem('My New Item',lnIndex)
.LockScreen = .F.
ENDWITH
Just curious. [sig]<p>Jon Hawkins<br><a href=mailto: jonscott8@yahoo.com> jonscott8@yahoo.com</a><br><a href= > </a><br>Focus on the solution....Not the problem.[/sig]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.