Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. using BIBLIOTECA_CLASES;
  2.  
  3. namespace WpfAnfp
  4. {
  5. /// <summary>
  6. /// Lógica de interacción para MainWindow.xaml
  7. /// </summary>
  8. public partial class MainWindow : Window
  9. {
  10. public JUGADOR jugador1;
  11. public MainWindow()
  12. {
  13. InitializeComponent();
  14. }
  15.  
  16. private void btmGrabar_Click(object sender, RoutedEventArgs e)
  17. {
  18. jugador1 = new JUGADOR();
  19. try
  20. {
  21. jugador1.Nombre = txtNombre.Text;
  22. jugador1.Edad = int.Parse(txtEdad.Text);
  23. jugador1.Posicion = cboPosicion.Text;
  24. jugador1.NumeroCamiseta = int.Parse(txtNumeroCamiseta.Text);
  25. MessageBox.Show("Datos almacenados en la clase");
  26. }
  27. catch (Exception ex)
  28. {
  29. MessageBox.Show(ex.Message);
  30. }
  31. }
  32.  
  33. private void btmListar_Click(object sender, RoutedEventArgs e)
  34. {
  35. StringBuilder texto = new StringBuilder();
  36. texto.AppendLine("Nombre: " + jugador1.Nombre);
  37. texto.AppendLine("\nEdad: " + jugador1.Edad);
  38. texto.AppendLine("\nNumero Camiseta: " + jugador1.NumeroCamiseta);
  39. texto.AppendLine("\nPosicion: " + jugador1.Posicion);
  40.  
  41.  
  42. MessageBox.Show(texto.ToString());
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement