Home | Index | Dotnet4all Snippets | Submit resources
About | Mail us 





Knew how to do it the old way, but ... (Tuesday, January 03, 2006)



Found the following interesting discussion in the Newsgroups:

Knew how to do it the old way, but ...
by: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



 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 

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

<URL:http://www.google.de/groups?selm=2hemflFbikgkU2%40uni-berlin.de>
--
Herfried K. Wagner [MVP]


 Reply:
by:Armin Zingler

 
http://groups.google.com/groups?threadm=eniMT6RhDHA.3324@TK2MSFTNGP11.phx.gbl>
--
Armin

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



Posted by Xander Zelders



0 Comments:

Post a Comment

<< Home

 
Previous Posts
    - when to use DoEvents in vb.net?
    - Playing Audio from a Filestream using MCI
    - XML in a combobox
    - Setup Project
    - WMI Com Interop exception handling
    - Problem With Mailto Start Process
    - Comboboxes in windows forms datagrid
    - Sometimes I want to skip a page - How to do that
    - FxCop Error on command button
    - How to scroll down on listView (programmatically)



Disclaimer & Terms of Use | DotNet4All.Com concept & © 2004 - 2007 by Zelders² - Holland