Save DataGrid conetents in a text file?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I save the contents of a DataGrid (bound by a DataSet) in a text file

Also, how can I "Select All" rows of a DataGrid programmatically

Amjad
 
Hi Amjad,

A textfile is not that simple (because a textfile is flat), but to save it
as an XML file needs only one row of code.

dataset.writeXML(myfilepath)

I hope this helps,

Cor
 
Amjad:

I'm with Cor on this one...using DataSet.WriteXml is going to be the most
practical way. If you don't want the whole dataset written, you may want
to loop through each row of the underlying data source, and add a CrLf after
each row, and a delimmiter between each column. YOu can use a simple
TextWriter to accomplish this, but it's defintiely more work than the good
old WriteXML
 
Back
Top