private void bttn_load_Click(object sender, EventArgs e) { if (File.Exists(txt_dbName.Text + ".xml")) { XmlSerializer xs = new XmlSerializer(typeof(Daten)); FileStream read = new FileStream(txt_dbName.Text + ".xml", FileMode.Open, FileAccess.Read, FileShare.Read); Daten daten = (Daten)xs.Deserialize(read); txt_name.Text = daten.NAME; txt_ide.Text = daten.IDE; txt_prog.Text = daten.PROG; txt_dbName.Text = daten.DBNAME; } }
private void bttn_save_Click(object sender, EventArgs e) { try { Daten daten = new Daten(); daten.NAME = txt_name.Text; daten.IDE = txt_ide.Text; daten.PROG = txt_prog.Text; daten.DBNAME = txt_dbName.Text; string datenbank = txt_dbName.Text + ".xml"; SaveData.SaveDaten(daten, datenbank); } catch (Exception ex) { MessageBox.Show(ex.Message); } }