The switch Decision Statement - Day 1 - Part 13
- Posted: Nov 11, 2010 at 5:44 PM
- 28,035 Views
- 5 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
Picking back up on the notion of adding logic to your code, we look at a second decision statement—the switch—and compare its usefulness to the “if” statement we previously looked at.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
This might not be HUGELY important but your code has an error (in the video and the download). When you introduced the String.Format you should only have car, boat, cat or "... Sorry we didn't understand your response. You lose" in your message statement.
** Easy fix for someone who is familiar with programming language but to a newbie they might get a wee bit lost. As the output is not what is expected or originally intended by the programmer.
@Nique26: the correct solution would be to replace
myTextBlock.Text = String.Format("You won a {0}!", message);with
Or, just change message = "You won a new car!";
to
message = "new car";
hi
Nope, the code on the video works, is the download that have some bug in it.
If you copy paste the entire code on a new proyect (and name the textBlock and textBox just like the names on the video) the code works.
Remove this comment
Remove this thread
close