Switch Case Options

Discussion in 'C#' started by shah123, Apr 4, 2007.

  1. shah123

    shah123 New Member

    Joined:
    Mar 27, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    Hi If i have switch statement look like this and after getting or display function or by entering wrong character(default) how can i go to same screen which will display different options. As i know there are goto statements but that is not recommended? So please can anybody recommend me what to use or to do?
    Code:
    switch (s)
                {
                    case "g":
                    uname.getUserName();
                    break;
        
                    case "v":
                    uname.DisplayUserName();
                    break;
                   
                    default:
                    Console.WriteLine("Please select correct choice...");
    
    Thnx,
    Regards,
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Posting the same question in the wrong section multiple times is not the idea way to get help.
     
  3. shah123

    shah123 New Member

    Joined:
    Mar 27, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    I got small solution for that but Shabbir where should this thread be posted.
    Duplication was my mistake but when i tried to create a thread it denied so i thought its not allowing me to create for some reasons.
    Anyway applogize again for my mistake.
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    You posted it in the Article section by clicking the Submit article image. It should be under the Queries and Discussion forum where the link reads New Thread.
     
  5. shah123

    shah123 New Member

    Joined:
    Mar 27, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    ok Thanks
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice