Quantcast
Channel: problema al exportar txt
Viewing all articles
Browse latest Browse all 2

problema al exportar txt

0
0

Tengo un datagriview el cual deseo exportar a un txt el problema es que cuando creo el archivo luego de que voy a crear el textwriter me dice que esta siendo usado por otro proceso ..si alguien sabe sobre este error me podria yudar este es mi codigo no se si me falta algo..

string filename = @"C:\file12.txt";
                //string pathfile = Path.Combine(@"C:\file11.txt", filename);
                FileStream FileStream = new FileStream(filename, FileMode.Create);




                TextWriter sw = new StreamWriter(@"C:\file12.txt");
                int RowCount = dataGridView1.Rows.Count;
                for (int i = 0; i < RowCount - 1; i++)
                {


                    sw.WriteLine(dataGridView1.Rows[i].Cells[0].Value.ToString() + "\t" + dataGridView1.Rows[i].Cells[1].Value.ToString() + "\t\t" + dataGridView1.Rows[i].Cells[2].Value.ToString());
                }
                sw.Close();



Viewing all articles
Browse latest Browse all 2

Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Vimeo 10.6.2 by Vimeo.com, Inc.

Vimeo 10.6.2 by Vimeo.com, Inc.

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Re:

Re:





Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Re:

Re:

Re:

Re: