// save the data just before the form closes private void frmProducts_FormClosing(object sender, FormClosingEventArgs e) { ProductDB.SaveProducts(products); }
// read product from the file and display private void frmProducts_Load(object sender, EventArgs e) { products = ProductDB.ReadProducts(); DisplayProducts(); }
private void btnSave_Click(object sender, EventArgs e) { ProductDB.SaveProducts(products); }