I'm trying to change the form icon so that my taskbar icon changes. I'm using the following code:
and I'm getting a "type mismatch" error on the ampersand. Is this not a legal path for the icon?VB Code:
Me.Icon = App.Path & "\clear.ico"
Printable View
I'm trying to change the form icon so that my taskbar icon changes. I'm using the following code:
and I'm getting a "type mismatch" error on the ampersand. Is this not a legal path for the icon?VB Code:
Me.Icon = App.Path & "\clear.ico"
I think you need to load it as a picture first...
MyVar = LoadPicture(App.Path & "\clear.ico")
Me.Icon = MyVar
Just a guess
Nope.... that didn't do it.
Well, the reason is that you don't LoadPicture into a variable
Just:
Form1.Icon = LoadPicture(imgPath)
cjqp
why dont you just change the icon in the propertys box of the form to whatever icon you want.
Is this what you were looking for?
Cheers
Because I'm changing it at runtime.Quote:
Originally posted by laserman
why dont you just change the icon in the propertys box of the form to whatever icon you want.
Is this what you were looking for?
Cheers
Ok, cjqp's suggestion worked, but the icon in the taskbar does not get updated. Is there a way to refresh the taskbar?
Have you tried making it invisible and visible straight after?
It depends on how you are adding the icon to the taskbar, whether by your own code or by a 3rd party control. Some controls will automatically update the taskbar icon, some will not. You could remove/add the icon again to the taskbar to update the icon.
cjqp
I'm using my own code... the code that is posted all the time for using system tray icons.
And no, I haven't tried making it visible/invisible.
Maybe I'll just add this in the next release. It's only going to change the icon for a split second anyways.
I don't know much about adding icons to the sys tray, but I don't think making it invisible/visible will help. But like I said, I don't know that aspect.
cjqp
I didn't think that would work either... probably why I haven't attempted to do it.
But removing the icon and re-adding it would work. Shouldn't be to hard if you have good code, just function calls.
cjqp