Knew how to do it the old way, but ...

E

Ed Staffin

In vb6, I could load a listbox/combobox with strings and
values using the list and itemdata properties. WHen I
wanted to set the selected item to a value I looked
through the itemdata to find a match.

In vb7, I can't quite seem to figure it out. I can set the
datasource to a datatable, set the display member, set the
value member and have everything display properly.
However, once I have loaded the listbox/combobox with the
data, I can't figure out how to set the selectedIndex
property based on a value I have. I tried looking at the
items collection, but near as I can tell, that thing is
useless. Any guidance would be greatly appreciated.

Thanks ... Ed
 
H

Herfried K. Wagner [MVP]

* "Ed Staffin said:
In vb6, I could load a listbox/combobox with strings and
values using the list and itemdata properties. WHen I
wanted to set the selected item to a value I looked
through the itemdata to find a match.

The direct replacement is using custom objects to store additional data:

<URL:http://www.google.de/[email protected]>
 
A

Armin Zingler

Ed Staffin said:
In vb6, I could load a listbox/combobox with strings and
values using the list and itemdata properties. WHen I
wanted to set the selected item to a value I looked
through the itemdata to find a match.

In vb7, I can't quite seem to figure it out. I can set the
datasource to a datatable, set the display member, set the
value member and have everything display properly.
However, once I have loaded the listbox/combobox with the
data, I can't figure out how to set the selectedIndex
property based on a value I have. I tried looking at the
items collection, but near as I can tell, that thing is
useless. Any guidance would be greatly appreciated.


http://groups.google.com/[email protected]>


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top