Add to list (1 Viewer)

ddrew

seasoned user
Local time
Today, 08:07
Joined
Jan 26, 2003
Messages
911
I have a form with an empty list box and a couple of small pictures of flowers. I am trying to populate the list box with the name of the flower.

The pictures are called White Rose, Red Rose and Yelloe Rose. The List Box is called List1. I've tried a couple of methods but am unable to get it to work. Is it possible to do this or am I just graping at straws? Thanks!
 

Johny

Registered User.
Local time
Today, 09:07
Joined
Jun 1, 2004
Messages
80
I don't know exactly what you want. Are the pictures stored on the HD or are they placed on the form in imageframes?

Otherwise ya can write a function to read a directory on your HD and list all files, which ya can show in your listbox.
If it's this you want, I got the code for you
 

ddrew

seasoned user
Local time
Today, 08:07
Joined
Jan 26, 2003
Messages
911
No their on the form in image frames!
 

Johny

Registered User.
Local time
Today, 09:07
Joined
Jun 1, 2004
Messages
80
Well, I'd do it like this (dnno if it's the best way): you can specify the tag property of each imageframe you want in the listbox. Then you iterate through each control on your form and check the tag property. You can name your imageframes White Rose, Red Rose and Yelloe Rose so you just have to add the control name to the listbox

Code:
Dim ctrl As Control

For Each ctrl In Me.Controls
    if ctrl.Tag="ADDTOLB" then
        me.List1.additem ctrl.name
    end if
Next ctrl
me.List1.requery
 

Users who are viewing this thread

Top Bottom