PDA

Click to See Complete Forum and Search --> : List Box


Rob Brown
Oct 20th, 2000, 04:31 AM
Hi,

I have a list box on a VB5 form which I would like to display the following:

An Icon for each item,
Two fields from an Access 97 database beside each Icon.

Does anyone know how to do this?

Also I want the user to be able to change the text in the list box without updating the database (until they click OK or apply).

If you look at the Hardware Profiles property page in NT4 then you'll get a pretty good idea of what I'm trying to achieve.

Any suggestions would be much appreciated.

Best regards,

Rob Brown.

BruceG
Oct 20th, 2000, 06:32 AM
You would need the ListView control to do this; the basic listbox cannot handle icons or multiple fields (although a listbox item can be made to look like it has more than one field). Also, neither control will let you directly edit an item, but when a particular item is selected, you can display the data in a textbox; when the user is done editing the textbox(es), you can update that item in the ListView control (you can't modify an item in the Listbox; you'd have to clear it and reload it, another reason why the ListView would be a better choice).

I don't have time to get into the code right now, but I can check back later. I hope this gives you some ideas (have a look in the VB help on the Listview if you haven't used it before).

Rob Brown
Oct 20th, 2000, 10:39 AM
Thanks for your help Bruce,

I was editing the list box via an input box anyway and then setting the text property of the list box in code but thanks for clearing up my icon problem.

Will I be able to do this with the listview even though it's bound to a database?

Best regards,

Rob Brown.

BruceG
Oct 20th, 2000, 11:54 AM
I do not believe the ListView can be data-bound. (I must admit I'm biased against bound controls; I always use code.)