Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to add elements in listbox
Message
From
03/07/1997 12:04:35
 
 
To
03/07/1997 10:19:04
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00038489
Message ID:
00038544
Views:
41
Antonio,

I have found that AddItem and AddListItem have undocumented behaviour which is said by MS to be "by design".

My solution is to use the List property exclusively. Yes, I give up the ability to have an nItemID for any item, but that turns out to be an advantage if you plan on deleting items from the list. This is because RemoveItem does *NOT* maintain the nItemID "table", leaving it as-is, so if you later try to "add" an nItemID which was already previously added (then RemoveItem()ed), it will invariable go where the old item was regardless of where you WANT it to go.

Just thought you should know,
Jim N

>>>>>I would like to add elements to the 2nd column using the method ADDITEM into a listbox define with 2 columns and rowsourcetype = 0
>>>>>I have tried this commmand:
>>>>>THIS.Parent.lstSelected.AddItem(THIS.Parent.lstSource.List(nCnt,2),2)
>>>>>but does not function.
>>>>>
>>>>>In the additem method of lstSelected I have put nColumn in Parameters
>>>>>
>>>>>Can anyone help me?
>>>>
>>>>Have you tried the method AddListItem(Item, col, row) ?
>>>
>>>I included cColumn in PARAMETERS of ADDLISTITEM method and tried this
>>>
>>>THIS.Parent.lstSelected.AddListItem(THIS.Parent.lstSource.List(i,1),1)
>>>THIS.Parent.lstSelected.AddListItem(THIS.Parent.lstSource.List(i,2),2)
>>>
>>>The result is the same. The second column is added in the second row, not in
>>>the second column.
>>
>>The way to do it is :
>>THIS.PARENT.lstSelected.AddListItem(THIS.Parent.lstSource.List(i,1),1,1)
>>THIS.PARENT.lstSelected.AddListItem(THIS.Parent.lstSource.List(i,2),1,2)
>>The first parameter is the text item.
>>The second parameter is the row or unique id
>>the third parameter is the column position.
>>
>>You don't have to make any change in the addlistitem method.
>
>Ok. Now operated in the right way. Many Thanks.
Previous
Reply
Map
View

Click here to load this message in the networking platform