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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting application icons dynamically

Status
Not open for further replies.

afryer

Programmer
Mar 9, 2004
207
GB
Hi all, its me again. Stuck again. Scanned the forum, but can't see anything relating to this.

Basically what I need to do is change the icon displayed by the form at runtime. I have two icons created (sysok.ico and sysfail.ico). By default the sysok icon is used when the application starts up, but when the code detects a certain error I need to change to the sysfail icon.

Anyone any ideas how to do this?

Cheers
 

Store your icon in an imagelist.

Then something like...

Form.icon = imagelist.listimages.Item(1)
 
I would have a look at the forms .Icon Property and Loadpicture(). e.g. You can load a blank icon using:
Code:
Form1.Icon = LoadPicture("")
This code could be easily modified to include an actual icon rather than a blank.

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
You can also place the icons in a resource file and load them from there.

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top