473,395 Members | 1,571 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,395 software developers and data experts.

Change NotifyIcon.Icon if...

Tyler Wiebe
I'm wondering if it's possible to use an if statement to change a NotifyIcon.Icon property, more specifically like the following.

EXAMPLE:
Expand|Select|Wrap|Line Numbers
  1. private void ChangeIcon()
  2. {
  3.      if(NotifyIcon.Icon == Properties.Resources.Icon1) NotifyIcon.Icon = Properties.Resources.Icon2;
  4.      else NotifyIcon.Icon = Properties.Resources.Icon1;
  5. }
  6.  
But what it's really doing is "(Icon) == (Icon)".
So it's always stuck on the first if, so I'm wondering how I could get it to compare using the resource name or something else so it knows what Icon it's using.

Currently I'm just using a counter and changing the number each time.

EXAMPLE:
Expand|Select|Wrap|Line Numbers
  1. private int Number = 1;
  2. private void ChangeIcon()
  3. {
  4.      if(Number == 1) { NotifyIcon.Icon = Properties.Resources.Icon2; Number = 2; }
  5.      else { NotifyIcon.Icon = Properties.Resources.Icon1; Number = 1; }
  6. }
  7.  
And do keep in mind, that these are just small examples, I'm using 6 different icons, so I'm hoping there's a better solution.

All help is appreciated.
Sep 10 '11 #1
0 1634

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ATong | last post by:
A VC.net application, the 3 16777216-color icons, 16*16, 32*32 and 48*48, have been modified, but after rebuild the application, the icon does not change. Should we modify anything else to change...
1
by: Hai Ly Hoang | last post by:
Creating an Windows application with C# (a.exe). My program a.exe has default icon (in Windows Explorer). How to change default icon for my program ? (Certainly, not by creating an shortcuts to...
2
by: Randall Powell | last post by:
I am in the process of developing a Windows Service which will: (1) monitor multiple network shares; (2) marshal text file transfers into an SQL Server 2000 instance; and (3) provide messaging...
16
by: Phil Hey | last post by:
Hi, I can change the icon for a folder by right clicking on it > going to the customize tab > and selecting Choose Picture. Does anyone know if it is possible to do this programmatically...
1
by: Brett | last post by:
How can I change the icon of a form? This is the icon that appears in the upper left corner. Thanks, Brett
1
soulstace
by: soulstace | last post by:
Hi all, I have a project with two forms. Call them form1 and form2. On form1, I have a notifyIcon which appears in the system tray when the application starts. On form2, I have a textbox,...
1
by: Hutch | last post by:
Is there a way to change the Icon of accessto a different picture? I want to do this in the program some how so when i rewrite the MDE file it will appear as a change on everyones desktop. If i just...
3
by: faraz | last post by:
I have set the exe icon from Project Properties->Application->ico. now i always have the same icon on the exe. how can i change the icon of exe programmatically?
7
by: kalar | last post by:
i make a JFrame window and i add a label i.e. myLabel , which has an image and down from the label a button i.e. dice. I want when i press the button to change the image on the label but when i am...
4
by: mistral | last post by:
Does it possible change favicon icon depending on browser type: display favicon.ico for Internet Explorer browsers, and favicon.gif for the rest browsers? Problem is that ugly MSIE can display only...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.