Sky Alexander

Sky Alexander

  • NA
  • 1
  • 819

C# event handler question

Aug 11 2014 9:42 PM
So I built a simple program where the user will enter the pet's name and age and when they click the button it will simply grab that information and display it in the label fields but i am so confused. Can anyone help me out?
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Pet_s_Name
{


public partial class MainWindow : Window
{
private void Click_Click(object sender, RoutedEventArgs e)

{
//Fields should always be private
private string _name;
private int _age;

//Properties
public string Name
{
get { return _name; }
set { _name = value; }
}

public int Age
{
get{ return _age;}
set { _age = value; }
}

//Constructor
public Pet(string nam, int ag)
{
_name = nam;
_age = ag;
}


}
}
}
}
}

Answers (2)