Beispiel #1
0
        private void button14_Click(object sender, EventArgs e)
        {
            //新建一个list1
            int i = 0;

            for (i = this.listBox1.Items.Count - 1; i >= 0; i--)
            {
                listBox1.SelectedIndex = i;
                this.listBox1.Items.Remove(this.listBox1.SelectedItem);
            }
            xinlie = "新建列表" + (this.listBox2.Items.Count).ToString();
            this.listBox2.Items.Add(xinlie);
            //  FileStream fs = new FileStream("confi\\list\\list.txt",FileMode.Append);new StreamWriter
            StreamWriter listw = File.AppendText("confi\\list\\list.txt");

            listw.WriteLine(xinlie);
            listBox2.SelectedIndex = this.listBox2.Items.Count - 1;
            bflbx                      = listBox2.SelectedIndex;
            listnamego[bflbx]          = new listsong();
            listnamego[bflbx].listname = xinlie;
            nlist++;
            File.Create("confi\\list\\" + listnamego[bflbx].listname + ".txt").Close();
            listw.Close();
            listw.Dispose();
        }
Beispiel #2
0
        private void readfromtxt()
        {
            StreamReader listread = new StreamReader("confi\\list\\list.txt");

            list = listread.ReadLine();
            while (true)
            {
                if (list == null)
                {
                    break;
                }
                this.listBox2.Items.Add(list);
                listnamego[nlist]          = new listsong();
                listnamego[nlist].listname = list;
                listnamego[nlist].xian     = true;
                nlist++;
                list = listread.ReadLine();
                listBox2.SelectedIndex = 0;
            }
            listread.Close();
            listread.Dispose();
        }