Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding itemdata to listbox items 2

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
I am already using the ItemData part of the listbox, and the items added in the list. But I now need to put a single integer with each listitem. Any ideas. I tried putting in a decimal place in the itemdata, ie 110.10 but but it rounds it off as itemdata trims it to an integer. If it was an access type of box it would have been easy adding a column and hiding it. Any suggestions. Thanks
 
You could try making an Array and Redim it each time you additem to listbox.
 
u colud try using the forms 2.0 library...thats the Access list box.

be careful cause the if the client computer doesn't have office install u have to install the ActiveX Control Pad

 
Thanks very much dr486, I was convinced way back that listbox was in the system somewhere, but then resorted to it being a dram. Thanks a lot, will adopt it and hopefully will get there. Thanks waytech2003, I did consider a last resort of using an array. I was wondering whether there was a way at the time of making an additem statement to a listbox, getting its destination listindex value at the same time to use in an array. That would have made it easier to adopt and retrieve. But thanks both, feel generous so both can have stars.
 
Hi ZOR,

actually you don't need to explicitely assign a single integer, since each entry already has an integer assigned to it - the ListIndex property.
e.g. Me.YourListBox.Selected.ListIndex will give you this number.

ATTENTION: If your Multiselect property is set to YES, you must use a loop to check each selected item:
Dim ctlList
Set ctlList=Me.YourListBox
For Each Lmnt In ctList.ItemsSelected
YourIndex=Me..ItemData.ListIndex
Next

Does that help you?
MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
Bowne Global Solutions Wuppertal, Germany
(andreas.galambos@bowneglobal.de)
HP:
 
Thanks MakeItSo for your reply. My problem is this, I have 20 listboxes which contain items a user can select randomly from a single flexgrid. However the flexgrid appears in 4 combinations of data population. One could look at it as there being 4 flexgrids. My 20 lists are single column, and contain the text of one of the cells. The itemdata of each listitem is the record number of the item within a single table. However I now need to be able to get from each listitem a number representing 1-4 to identify which flexgrid option the item came from. Hope that has not muddled everyone.
dr486's idea of using an Access Listbox means I cah setup 3 columns, 2 hidden to do the job. However I cant find for the life of me, how to add data to the listbox, how to steer which column is to get the data, and of course how to get it all back. All my references to the listbox show it being filled by recordsets, and not a simple additem type approach. Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top