Solved

ImageList - extract Images from code

Posted on 2004-10-15
4
377 Views
Last Modified: 2013-12-26
Hi!

On a form I have an ImageList control named "ImageList"
I have added two images to it, and set it's keys to "Image1" and "Image2"
How do I set my form's Icon property "Image2" from this ImageList control?

I have tried the following, but it doesn't work:

'--------------------------------------------
Private Sub MDIForm_Load()
    Set Me.Icon = ImageList.ListImages.Item(2).Picture
End Sub
'-------------------------------------------

But I get "Invalid Property Value"

Thanks!
0
Comment
Question by:dbrckovi
  • 3
4 Comments
 
LVL 10

Expert Comment

by:fds_fatboy
ID: 12318721
Remove Set.

Private Sub MDIForm_Load()
    Me.Icon = ImageList.ListImages.Item(2).Picture
End Sub
0
 
LVL 10

Expert Comment

by:fds_fatboy
ID: 12318746
Actually it's odd - so far I can't replicate your problem - with set or not.
0
 
LVL 10

Accepted Solution

by:
fds_fatboy earned 125 total points
ID: 12318762
Now I can - You are using a bitmap in your list image - try this:
    Me.Icon = ImageList1.ListImages.Item(2).ExtractIcon
0
 
LVL 11

Author Comment

by:dbrckovi
ID: 12318812
Thanks!
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question