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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine listindex of Combobox Items 1

Status
Not open for further replies.

rskomal

Programmer
Feb 2, 2003
13
IN
Hi There
Please help me to sort this problem out. i am using following lines to save listindex of combobox items to listview control but nothing is showing in listview. I need to store listindex in listview for editing purpose.

Thanking u in anticipation
Raj



For cbit = 0 To CboItems.ListCount - 1
For edLv = 1 To LvEdt.ListItems.Count
If CboItems.List(cbit) = LvEdt.ListItems.Item(edLv).SubItems(2) Then
LvEdt.ListItems.Item(edLv).SubItems(20) = CboItems.ListIndex
Exit For
End If
Next edLv
Next cbit
 
Have you added Column Headers in your list view?

------------------------------------------
The faulty interface lies between the chair and the keyboard.
 
yes i have, vbsun, but i dont think that make any difference.
 
try this it should work with vb5 or vb6

For cbit = 0 To CboItems.ListCount - 1
LvEdt.AddItem CboItems.List(cbit)
Next cbit

this will place all data from your combo box to your listview control
 
Listindex refers to the selected item and you don't seem to be selecting anything. Isn't the value you want just cbo?
.List gives the text for an item
 
By looping through the list property I don't believe that you are actually changing the listindex peoperty. Instead of assigning the combo listindex, try assigning the counter variable value (which should be the listindex).
Code:
...
   LvEdt.ListItems.Item(edLv).SubItems(20) = cbit
...


zemp
 
I thought you were heading that way Peter. But your "cbo" threw me. I thought you might be referring to the combo box.

zemp
 
Dear Zemp thnx for your timely help, its working now. and i thanks all those too who given their time to help me. Thanks u all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top