I asked about this on the forums awhile back, and was given replies that these styles are the only way possible. Since I know alot of beginners and some intermediate visual programmers have questions about these two things, I decided to write a brief but in-depth example with three ways to implement the toolbar and imagelist into your application.
1. A pre-set imagelist
2. Load Images from a set directory
3. Let the consumer (user) chooses
Hope it helps anyone looking for answers on thsi subject =)
Please use the search function prior to posting a question and see if someone's already answered it.
-If I helped you, please rate me, as I'd do the same for you =)
-Remember to select the Resolved option for your post when you've gotten the answers you need.
Thanks for the code. In your Load Images from a set directory example,
how would you add all the icons in the directory wihtout having to specify each one individually?
Thanks for the code. In your Load Images from a set directory example,
how would you add all the icons in the directory wihtout having to specify each one individually?
You can use the Dir command to get file names, something like,....
Code:
'Load the images to the respective ImageList
Dim strDir As String
Dim strFile As String
Dim intCount As Integer
' set path
strDir = App.Path & "\gfx\One\"
' get all "*.ico" filenames in strDir folder
strFile = Dir(strDir & "*.ico", vbNormal)
Do Until strFile = vbNullString
intCount = intCount + 1
' add to img list
Call ImageList1.ListImages.Add(intCount, "", LoadPicture(strDir & strFile))
strFile = Dir ' get next filename
Loop
' [continue with the rest of code]
'Set the toolbar so that it reads.......