How to add a 'light' to my .Net Form Application -> does the toolbox provide simple lights i.e. red/green


I have a .Net Form App and I want to add two lights which will signify a GO/NO-GO status.

After looking through all the options on the toolbox, I didn't see anything that seemed to fit the bill.

How can I incorporate such a thing and what is the exact code to turn such lights on with the appropriate color ?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There is a article talking about VB.NET. Wish it is helpful to you as well.
Creating Visual Basic .NET Controls from Scratch
mahesh1402IT ProfessionalCommented:
and also a LED control in C# here may help :

John500Author Commented:
Thanks to both of you, but this won't work for me.  I'm looking for direct references to Visual C++ .Net toolbox objects and some sample code C++ code
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

AndyAinscowFreelance programmer / ConsultantCommented:
Two icons - one red, one green.
Use two times picture control, one for each icon.
For go hide the red picture and show the green, you get the idea.
John500Author Commented:

>> Two icons - one red, one green.

I'm not as versed in such things as you might expect.  How would I create an icon from scratch?  After that I'm guessing the properties of the icon would allow me to set a default color.  If so, I'd need to know how to change that color during run-time.  Lastly, I would prefer the icon to be round rather than square.  The more I think about it, I don't need two, just one that can change from red to green.

Thanks !
John500Author Commented:

I guess I'm not as bad as I thought I was.  I created a round red icon and a green one also from 'Paint'.  I saved them as icons and then imported them into my project's GroupBox as pictureBoxes.  

What did you mean by 'two times picture control' ?  Are you saying I should put one picture on top of the other and then show which ever one I want depending upon the status?  In any event, these objects are called pictureBox1 and pictureBox2.  What would the code look like to display them ?

You're on the right lines so far with the 2 picture boxes.
Assuming PictureBox 1 is 'green', and ValidInput is  a bool, set by a Validation function:

if ( ValidInput == true )
   PictureBox1.visible = true;
   PictureBox2.visible = false;
   PictureBox1.visible = false;
   PictureBox2.visible = true;

obviously replace ValidInput with whatever condition you want to check, but this will get you going for now.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
In the resource editor of visual studio you can create icons.
Put a picture box control onto your form and you should be able to select the type of picture as icon and the ID (of the icon you just created).  Now you have one picture control with for instance a red circle in it.  Do the same to create a second, green, icon.  Add a second picture control and link the picture control to the icon.
Now all you need to do is toggle the visible state of the control depending on which icon you want to display.

You need two picture controls because each contains one image.  (You could do it with one control and swap the images but using two controls and visibility is simpler to code).
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.