Saturday, May 22, 2010

(VS2K8 C#) Does any one know how to select items in a .Net List Box by VALUE???? Thanks?

for example book conditions is a many to many relationship in my database, so im filtering the many to many table by the bookid to show me the conditions for that book exactly, then i want to select these condtiontions in a list box on a form by there ID





which makes total sense





except, i can select by index and stuff but not value, and if i do it all by index there is the functionality to add new condtions so then those new condtions wouldnt work because they wouldnt need to be hard coded





any help??


thanks

(VS2K8 C#) Does any one know how to select items in a .Net List Box by VALUE???? Thanks?
you can do .Items.FindByValue then once u have the item u want


just do .Selected = true;


make sure your listbox allows multi-select, otherwise u will get a exception.


No comments:

Post a Comment