Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using BIBLIOTECA_CLASES;
- namespace WpfAnfp
- {
- /// <summary>
- /// Lógica de interacción para MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public JUGADOR jugador1;
- public MainWindow()
- {
- InitializeComponent();
- }
- private void btmGrabar_Click(object sender, RoutedEventArgs e)
- {
- jugador1 = new JUGADOR();
- try
- {
- jugador1.Nombre = txtNombre.Text;
- jugador1.Edad = int.Parse(txtEdad.Text);
- jugador1.Posicion = cboPosicion.Text;
- jugador1.NumeroCamiseta = int.Parse(txtNumeroCamiseta.Text);
- MessageBox.Show("Datos almacenados en la clase");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private void btmListar_Click(object sender, RoutedEventArgs e)
- {
- StringBuilder texto = new StringBuilder();
- texto.AppendLine("Nombre: " + jugador1.Nombre);
- texto.AppendLine("\nEdad: " + jugador1.Edad);
- texto.AppendLine("\nNumero Camiseta: " + jugador1.NumeroCamiseta);
- texto.AppendLine("\nPosicion: " + jugador1.Posicion);
- MessageBox.Show(texto.ToString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement