Im using VS2010 with C# and a WinForm. When a certain condition is met, I would like the notifyicon in C# alternate between two icons. I see that the code below is created for a single icon but I can't see how to programmatically change it. The "((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon")))" part doesn't make sense to me.
notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon")));
I tried...
notifyIcon.Icon = (System.Drawing.Icon(Application.StartupPath + @"\noneed.ico"));
but wont work. I get the error "System.Drawing.Icon' is a 'type', which is not valid in the given context"
Thanks for the help
you forget to add a new
keyword:
notifyIcon.Icon = new System.Drawing.Icon( Application.StartupPath + @"\noneed.ico" );