Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

The switch Decision Statement - Day 1 - Part 13

9 minutes, 11 seconds


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.

Download the source code in c#

Download the source code in VB.Net

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • NiqueNique26 Unemploymen​t, it's not a job, it's an ADVENTURE!

    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.

  • Clint RutkasClint I'm a "developer"

    @Nique26: the correct solution would be to replace

    myTextBlock.Text = String.Format("You won a {0}!", message);


    myTextBlock.Text = message;

  • Or, just change message = "You won a new car!";


    message = "new car";

  • mmiommio


  • 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


Comments closed

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.