Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fill imagelist from dir 1

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
425
IT
How to fill imagelist1, with img in c:\mydirimage\, are only a .jpg image?

i need to set key of imagelist with name of image and the tag of imagelist with name of image
 
The following is an illustrative example, not a definitive solution. Be aware that the first image loaded defines the width and height of all images that are to be loaded.

Code:
[COLOR=blue]Public Sub LoadImages(iList As ImageList, strPath As String, strPattern As String)
    Dim myfile As String
    myfile = Dir(strPath & strPattern)
    Do Until myfile = ""
        ImageList1.ListImages.Add , myfile, LoadPicture(strPath & myfile)
        myfile = Dir
    Loop
End Sub[/color]

And this might be called as follows:

Code:
[COLOR=blue]LoadImages ImageList1, "c:\mydirimage\", "*.jpg"[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top