Мартин

  • 02:58:48 pm on ноември 4, 2009 | 0

    Четене и запис на файл:

    StreamReader re = File.OpenText(f);
    string input = null;

    while ((input = re.ReadLine()) != null)
    {
    ListViewItem a = new ListViewItem();
    string[] red = input.Split(sep);
    };

    Запис на файл:

    TextWriter tWriter = new StreamWriter(f);  //f – стринг с пътя и името на файла

    for (int i = 0; i <= listView1.Items.Count – 1; i++)
    {
    tWriter.WriteLine(“Ред 1″ );
    tWriter.WriteLine(“Ред 2″ );
    tWriter.WriteLine(“Ред 3″ );
    }

    tWriter.Close();

     

Вашият коментар

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Промяна )

Twitter picture

You are commenting using your Twitter account. Log Out / Промяна )

Facebook photo

You are commenting using your Facebook account. Log Out / Промяна )

Connecting to %s

Follow

Get every new post delivered to your Inbox.