none
dhvms RRS feed

  • 질문

  • public partial class Form1 : Form //디렉토리-파일///열기
        {
            public Form1()
            {
                InitializeComponent();
            }

            private void 열기ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                openFileDialog1.ShowDialog();
                DirectoryInfo[] dir;
                DirectoryInfo dinfo = new DirectoryInfo(openFileDialog1.FileName);
                FileInfo finfo = new FileInfo(openFileDialog1.FileName);

                dinfo = finfo.Directory;
                dir = dinfo.GetDirectories();
                listBox1.Items.Clear();
                listBox2.Items.Clear();

                foreach (DirectoryInfo d in dir)
                {
                    listBox1.Items.Add(d.Name.ToString());
                }
                FileInfo[] files = dinfo.GetFiles();

                foreach (FileInfo f in files)
                {
                    listBox2.Items.Add(f.Name.ToString());
                }
                Form1.ActiveForm.Text = dinfo.FullName;
           
            }
        }
    }

    2009년 10월 14일 수요일 오전 3:28

모든 응답

  • using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Collections;
    using System.IO;

    namespace 주_소_록
    {
        public partial class Form1 : Form
        {
            ArrayList data = new ArrayList();
            CARD card;
            int a=0 ,b;
            string fname = "noname.txt";
          
            public Form1()
            {
                InitializeComponent();
            }

            private void button1_Click(object sender, EventArgs e)
            {
                ListViewItem item = new ListViewItem(textBox1.Text, int.Parse(textBox4.Text));
                item.SubItems.Add(textBox2.Text);
                item.SubItems.  d(textBox3.Text);
                item.SubItems.Add(comboBox1.Text);
                listView1.Items.Add(item);
                         
                card = new CARD();
                card.na = textBox1.Text;
                card.ad = textBox2.Text;
                card.ph = textBox3.Text;
                card.sex = comboBox1.Text;
                data.Add(card);
                card.count = a;
                a++;
              
                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();
                textBox4.Clear();


            }
            public class CARD
            {
                public string na;
                public string ad;
                public string ph;
                public string sex;
                public int count;

        }
            private void button5_Click(object sender, EventArgs e)
            {
                if (textBox1.Text == "")
                    b = 0;
                else if (a == b + 1)
                    b = 0;
                else
                    foreach (CARD z in data)
                    {
                        if (z.na == textBox1.Text)
                            b = z.count + 1;
                    }
                foreach (CARD dd in data)
                {
                    if (dd.count == b)
                    {
                        textBox1.Text = dd.na;
                        textBox2.Text = dd.ad;
                        textBox3.Text = dd.ph;
                       
                    }
                }
            }
           

            private void button2_Click(object sender, EventArgs e)
            {
                listView1.Items.Remove(listView1.FocusedItem);
            }

            private void button3_Click(object sender, EventArgs e)
            {
                listView1.Sorting = SortOrder.Ascending;
            }

            private void toolStripButton1_Click(object sender, EventArgs e)
            {
                listView1.View = View.Details;
            }

            private void toolStripButton2_Click(object sender, EventArgs e)
            {
                listView1.View = View.LargeIcon;
            }

            private void toolStripButton3_Click(object sender, EventArgs e)
            {
                listView1.View = View.SmallIcon;
            }

            private void toolStripButton4_Click(object sender, EventArgs e)
            {
                listView1.View = View.List;
            }

            private void button4_Click(object sender, EventArgs e)
            {
                Form2 dig = new Form2(this);
                dig.Show();
            }

    2009년 10월 14일 수요일 오전 3:43