public Form1() { InitializeComponent(); pb = new phoneBook(); //pData = new phoneData(); //pb.Add("tmin", "none", "next"); //pb.Add("eun", "010 - 0000 - 0000", "mv"); saveFileDialog1.Filter = "저장파일(*.xml)|*.xml|모든파일(*.*)|*.*"; }
private void button1_Click(object sender, EventArgs e) { if (!(openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)) { return; } XmlSerializer xs = new XmlSerializer(typeof(phoneBook)); StreamReader sr = new StreamReader(openFileDialog1.FileName, Encoding.GetEncoding("euc-kr")); pb = (phoneBook)xs.Deserialize(sr); sr.Close(); textBox1.Text = pb.getAllData(); }