473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

ImageList & Treevie

I am using a Treeview type menu sustem and need to load various icons

I have a form called Icons with a MSComctlLib.ImageListCtrl.2 control on it
called ImList

The IconTable holds IconNo and IconName

I use the following code OnOpen of the form which is supposed to load images
stored in a folder which is defined by CoIconPath

Function ImageList_Fill(ByVal ImageList As Object, ByVal IconTableName As
String) As Boolean

On Error GoTo ImageList_Fill_Error

Dim img As ListImage
Dim MyDb As Database
Dim IconTable As Recordset

'*initialise
ImageList_Fill = False

ImList.Object.ImageWidth = 16
ImList.Object.ImageHeight = 16

Set MyDb = CurrentDb()
Set IconTable = MyDb.OpenRecordset(IconTableName, dbOpenDynaset)
With IconTable

' If no icons specified - exit
If .RecordCount = 0 Then GoTo ImageList_Fill_Exit

.MoveFirst
While Not .EOF
' Add Image
Set img = ImageList.ListImages.Add(!IconNo + 1, !IconName, _
LoadPicture(CoIconPath & "\" & !IconName & ".ico"))
'StoredIcon.Picture = img.Picture
MsgBox "Image" & img.Index, vbOKOnly
.MoveNext
Wend

' Success
ImageList_Fill = True

ImageList_Fill_Exit:
.Close
Set IconTable = Nothing
End With

MyDb.Close

Set MyDb = Nothing

DoCmd.Save , Me.Name
Exit Function

ImageList_Fill_Error:
MsgBox Err.Description, vbCritical, "No." & Err.Number
Resume ImageList_Fill_Exit

End Function

The message box comes up 11 times, so I guess that the images are loaded. If
I go back to the form in design view, the InList control shows no images.
Why
How do I display what is held in this control.
If I uncomment out the line StoredIcon.Picture = img.Picture, I get an error
message "Microsoft Access can't open the file '55033946'. This file number
appears different every time

Any help please

Thanks

Phil
Oct 9 '08 #1
0 3160

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bob C. | last post by:
Hi All, I am using the ImageList/ListView Components to display around 100 images in C#.NET. The issue i have is, some times i may need to display the thumbnail of size more then 256x256 in...
2
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error...
4
by: David | last post by:
I have a problem that just cropped up with using an ImageList in my project I am using VB .NET 200 Problem: I have existing Form with 2 Image List controls. ImageList16 (for 16x16 Images) and...
4
by: Just Me | last post by:
If I add an image to an imagelist using imageList.Images.Add... And use it with a tree node tn.ImageIndex = imageList.Images.Count-1 This is the actual code:...
1
by: VBTricks.de.vu Webmaster | last post by:
Hello, I created an application (Windows Forms) with a form and an imagelist. Everything works fine under WinXP, but when I try to start the app on Win98, the following error is returned:...
2
by: Hawk | last post by:
private void RetreiveVirtualItem( object sender, RetrieveVirtualItemEventArgs e ) { e.Item = new ListViewItem( e.ItemIndex.ToString() ); } Take this for example; works fine. Now if I want...
6
by: henrycortezwu | last post by:
Hi, I have a WinXPSP2, P4 3.2GHZ, 1GIG RAM on my dev machine using VS2005 VB.NET. I did the following procedure: 1. Added 82 icons (128x128 in size & 32bit Depth) in an imagelist control 2....
1
by: John Devlon | last post by:
Hi, Does anyone know how to assign an image from an imagelist to a picturebox ? How do dynamicly change the picture to another image of the imagelist ? Thanx John
2
by: =?Utf-8?B?S2VuTg==?= | last post by:
We're using a System.Windows.Forms.ImageList to store a bunch of Images that I've loaded, and rendering each image in the ImageList during a draw loop. The process was running unusually slow and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.