Posted By

kayes on 04/23/10


Tagged

test


Versions (?)

test


 / Published in: C#
 

  1. using System;
  2. using System.Windows.Forms;
  3. using System.Diagnostics;
  4.  
  5. namespace EnumWithCombo
  6. {
  7. public partial class PlayerSelectionForm : Form
  8. {
  9. private enum Players
  10. {
  11. Gibbs, Richards, Cronje, Kirsten, Kallis, Smith, Villiers, Pollock, Ntini, Klusener, Steyn, Rhodes, Bosman, Kemp, Botha, Harris, Roelof
  12. }
  13. private string url = "http://www.cricinfo.com/ci/content/player/45224.html";
  14.  
  15. public PlayerSelectionForm()
  16. {
  17. InitializeComponent();
  18. playersComboBox.DataSource = Enum.GetValues(typeof(Players));
  19. }
  20.  
  21. private void submitButton_Click(object sender, EventArgs e)
  22. {
  23. switch ((Players)playersComboBox.SelectedItem)
  24. {
  25. case Players.Gibbs:
  26. Process.Start(new ProcessStartInfo("iexplore", url));
  27. break;
  28. default:
  29. MessageBox.Show(((Players)playersComboBox.SelectedItem).ToString());
  30. break;
  31. }
  32. }
  33. }
  34. }

Report this snippet  

You need to login to post a comment.