//loads the contents of the xml public void LoadDatabase() { if (File.Exists("shop.xml")) { //opens up the shop.xml file for the information of the items... XmlSerializer serializer = new XmlSerializer(typeof(productlist)); using (Stream stream = File.Open("shop.xml", FileMode.Open)) { pl = (productlist)serializer.Deserialize(stream); } } }
private void Recycle_Shop_Load(object sender, EventArgs e) { if (File.Exists("shop.xml")) { //opens up the shop.xml file for the information of the items... XmlSerializer serializer = new XmlSerializer(typeof(productlist)); using (Stream stream = File.Open("shop.xml", FileMode.Open)) { pl = (productlist)serializer.Deserialize(stream); } } foreach (product p in pl.product_list) { comboBox1.Items.Add(p.name); } }