skymong9.egloos.com

Activation...

포토로그



[C#] XML 파일 읽고 출력하기 my dev_study

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace Client_Test1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            WebFile wf = new WebFile();
            wf.FileSave(txtRead.Text, txtSave.Text);

        }

        private void button2_Click(object sender, EventArgs e)
        {

            // 리스트 박스 출력

           // XmlTextReader Xmltr = new XmlTextReader("http://localhost:8033/ch01-01.xml");

            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load("http://localhost:8033/ch01-01.xml");

           

            XmlNodeList xmllist = xmldoc.GetElementsByTagName("과일");

            for (int i = 0; i < xmllist.Count; i++)
            {
                checkedListBox1.Items.Add(xmllist[i].ChildNodes[0].Value);
               
            }

            //while (Xmltr.Read())
            //{
           
               
            //    listBox1.Items.Add("<" + Xmltr.Name + ">" + Xmltr.Value);
            //}
                               

            //Xmltr.Close();
         

            // 그리드뷰 출력

            //DataSet dataSet = new DataSet();

            //dataSet.ReadXml("http://localhost:8033/ch01-01.xml");

            //BindingSource bindingSource = new BindingSource();
            //bindingSource.DataSource = dataSet.Tables[0];

            //dataGridView1.DataSource = bindingSource;

 

        }

        private void button3_Click(object sender, EventArgs e)
        {
            XmlDocument xdoc = new XmlDocument();
            xdoc.Load("http://localhost:8033/ch01-01.xml");

 

            XmlNodeList nodelist = xdoc.SelectNodes("/제품/제품정보");

            foreach (XmlNode node in nodelist)
            {
                checkedListBox1.Items.Add(node.InnerText.Trim());
               
            }
        }

        private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}


덧글

댓글 입력 영역