Jump to content
|Topic||Stats||Last action by|
|Falcon 9 / Dragon CRS-6 ISS resupply||
|Marvel's 'Daredevil' becomes the second most pirated TV show on the internet||
|Official Dogs vs Cats||
|Another bad ad||
|Latest Nvidia GPU driver comes with support for linux kernel 4.0!||
Posted 03 February 2013 - 22:31
Posted 03 February 2013 - 22:41
Hey Everyone -
I am taking an intro class to VB and we are working on the Light Bulb project (some of you may have heard of it). Essentially the way it works is you click on a picture of a light bulb to "turn it on" and you get a message that tell you to turn it off, so you click it again to turn it off and the process restarts. It's setup so that you can change the color of the output text (which I have working) and I also have the concatenation working, but not tied to the light bulb yet.
Unfortunately, the text book for this course is EXTREMELY vague with respect to the project, so if you're stuck; like me, well, you're on your own. I've done some Google searches and I found a blog from someone who did this project, but their code in my opinion is less than stellar, it just doesn't make sense because it appears that some of the methods she used, we haven't learned yet.
Anyway, on to my problem. I have the light bulb working (sort of). When I run the program within VB to debug the program starts with the light off, which is what it's supposed to do, you can click it again and it turns on, which is what it's supposed to do, however, when you click it again to turn it back off, it just disappears completely and you can't get it back without exiting and re-running the project. I know it's something I'm missing in the code (obviously), but what it is that I am missing, I haven't a clue. I've read the chapter backwards and forwards and I'm not seeing what I am missing. I am sure it's mentioned, but probably only in passing or in a very small paragraph. It mentioned concatenation in this manner, I had to figure it out by trial and error.
Is anyone familiar with this project or program? I don't have it with me currently, but I can email it (or attach it to this post) to whomever might be willing to help me out if you need to see the project or code. We haven't gotten into If, then, else statements or anything like that, so I'm pretty sure there is another method to get this working correctly.
Any help anyone can provide would be greatly appreciated.
Posted 03 February 2013 - 23:16
Dim x as integer x = 1 Do until x = 2 'Notice that the variable never changes LightBulb.Visiible = Not LightBulb.visible 'Assuming the "Light Bulb" is a control such as a image MessageBox.Show("Click to change light") Loop
Posted 03 February 2013 - 23:45
Posted 03 February 2013 - 23:49
Posted 04 February 2013 - 01:19
Posted 04 February 2013 - 02:12
Posted 04 February 2013 - 03:17
The issue is probably that the "On" picture box is set to invisible, but the "Off" picture box is not set back to visible, so none of them display.
The way it works is there are two picture boxes one on top of the other. One box shows the bulb off, the other shows it on. So when you click on it repeatedly, it makes it look like it's turning on and off. And then when clicking it a message displays. Basically turning the light off gives a message that tell you to turn it on and vice versa. The problem is when I try to go from on to off, the control disappears completely. As I said, the book is VERY vague in my opinion.
Posted 04 February 2013 - 06:10
Posted 05 February 2013 - 01:20
code goes here