Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi I'm new to programming and I need help with a certain question.
 
Creating a windows application that has a TextBox to input a letter which can be E or F or G or I. Including appropriate label near the text box. E represents English, F represents French, G represents German and I represents Italian. Have a submit button which when clicked will display using a message showing the language that the user has chosen.
 
Can someone help me write out the code and help me understand it? Thanks.
Posted 28-Nov-12 14:21pm
Edited 5-Dec-12 8:08am
v4
Comments
Pro Idiot at 28-Nov-12 22:58pm
   
BC @ CV at 5-Dec-12 15:40pm
   
It sounds like you'd be better off using a ComboBox rather than a TextBox. What happens when someone enters 'A', 'Word', '1' or '#$%&*'?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You only add the follow "switch" code in the button click event Handler:
 
  string language = "unkown language";
  switch (Textbox1.Text.ToUpper())
  {
      case "E":
        language = "English";
        break;
        
    //...
  }
  MessageBox.Show(language);

All in the above, good luck to u.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 397
1 OriginalGriff 350
2 thatraja 205
3 Emre Ataseven 165
4 Shai Vashdi 150
0 Sergey Alexandrovich Kryukov 8,894
1 OriginalGriff 5,200
2 Peter Leow 3,955
3 Maciej Los 3,535
4 Abhinav S 3,208


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 5 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid