Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- using System.Windows.Forms;
- namespace Baustoff_Verzeichnis_mh
- {
- public partial class Form1 : Form
- {
- CBaustoffe baustoff;
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- baustoff = new CBaustoffe();
- baustoff.material = "KS";
- baustoff.format = "NF";
- baustoff.lamda = 1;
- baustoff.rohdichte = 2;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- textBox1.Text = baustoff.material;
- textBox2.Text = baustoff.format;
- textBox3.Text = Convert.ToString(baustoff.rohdichte);
- textBox4.Text = Convert.ToString(baustoff.lamda);
- schreibeDatei();
- }
- public void schreibeDatei()
- {
- using (var fs = File.Create("Baustoffe.xml")) {
- new XmlSerializer(typeof(CBaustoffe)).Serialize(fs, baustoff);
- }
- }
- public void leseDatei()
- {
- using (var fs = File.Open("Baustoffe.xml")) {
- baustoff = (CBaustoffe)new XmlSerializer(typeof(CBaustoffe)).Deserialize(fs);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement