private void loadJoe_Click(object sender, EventArgs e) { using (Stream input = File.OpenRead("Guy_File.dat")) { BinaryFormatter formatter = new BinaryFormatter(); joe = (Guy)formatter.Deserialize(input); } UpdateForm(); }
public Form1() { InitializeComponent(); joe = new Guy() { Cash = 50, Name = "Joe" }; bob = new Guy() { Cash = 100, Name = "Bob" }; UpdateForm(); }