Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Updated 5-Dec-12 8:08am
v4
Comments
Pro Idiot 28-Nov-12 22:58pm    
BC @ CV 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

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

  //...
}
MessageBox.Show(language);

All in the above, good luck to u.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900