Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology

LinkBack Thread Tools
Old 09-17-2004, 09:53 AM   #1 (permalink)
Location: PVB, FL
VB Question

I am having a difficult time with something that must be really simple - I just have no background with VB.

I have a list box that I populated with the NAMES of certain items. I now want to select the item (not the name).

I am a little more than frustrated... Is there anyone who can help with this?
liberator-44 is offline  
Old 09-17-2004, 11:26 AM   #2 (permalink)
What are the items you talk about? A listbox can only contain names, if those names represent some objects somewhere else, you need to be able to reference those objects using the names selected in your listbox...
Old 09-17-2004, 08:03 PM   #3 (permalink)
Location: dfw - texas
selection in a simple listbox is controlled by the "listindex" property. it's zero-based, so the first item in the list is listindex = 0. if no items in the list are selected, listindex = -1.

hope it helps!
Depression is just anger without enthusiasm. Itís having an empty beer bottle but no one to throw it at.
2sheds is offline  
Old 09-19-2004, 09:34 AM   #4 (permalink)
Location: PVB, FL
Thanks very much for the assistance zen_tom and 2sheds - I used a loop to match the strings to the objects.

liberator-44 is offline  
Old 09-19-2004, 12:54 PM   #5 (permalink)
Devils Cabana Boy
Dilbert1234567's Avatar
Location: Central Coast CA
create a form with a listbox (list1) a label (label1) and enter the code

Private Sub Form_Load()
List1.AddItem "test1"
List1.AddItem "test2"
List1.AddItem "test3"
List1.AddItem "test4"
List1.AddItem "test5"
' this will add 5 entries into the list box

End Sub

Private Sub List1_Click()
Label1.Caption = "the item you selected is: " & List1.List(List1.ListIndex) & Chr(10) & Chr(13) & " Its index associated with it is: " & List1.ListIndex

'on the event that the list box is clicked, it will change the caption of the label using the listindex of list1.
'CHR(10) & CHR(13) is a 'return'

End Sub

this should give you a decent understanding of the list box.
Donate Blood!

"Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen

Last edited by Dilbert1234567; 09-19-2004 at 12:58 PM..
Dilbert1234567 is offline  


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -8. The time now is 03:12 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54