public void sparaKund() { if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); BinaryWriter customerBinaryOut = new BinaryWriter(new FileStream(path, FileMode.Create, FileAccess.Write)); foreach (Kund K in CustomerList) { customerBinaryOut.Write(K.PersonNr); customerBinaryOut.Write(K.Name); customerBinaryOut.Write(K.Loan.ToString()); //Not sure about this... }
customerBinaryOut.Close(); }
private void button1_Click_1(object sender, EventArgs e) //close button { sparaKund(); Environment.Exit(1); }