|
-
Jun 25th, 2000, 10:01 AM
#1
I remember being able somehow to store extra data for a item in a listbox but I cant remember how to do it. Like say you have list1.additem "Whatever" and you want to store something for whatever like a definition. So when they click on whatever it brings up that definition stored in the thing. On a few controls ive used they called it the key but the listbox doesnt have one of these that I can find..?? Any help?
-
Jun 25th, 2000, 10:08 AM
#2
Lively Member
Code:
list1.itemdata(1)=150
-
Jun 25th, 2000, 11:07 AM
#3
Hyperactive Member
You could also use a arrays to store how much data you want for each selection
Code:
Dim ExtraData() As String
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
-
Jun 25th, 2000, 11:21 AM
#4
Hyperactive Member
The listbox specifically doesn't have the ability to add extra data...
The combobox, listview and most grids (as well as collections) DO have this ability.
Your choices are simple.
1. Use a listview that only has a single column.
2. Create a collection to match the listbox
Code:
Dim cList as New Collection
list1.additem "display"
cList.add "display", "keyvalue"
Sub list1_click()
msgbox "Extra Information " & cList(list1.listindex).key
End Sub
You just have to make sure both the listbox and the collection are kept in sync
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|