hey, I'm using a windows form here,and I need to convert a datagridview
(actually its an Inragistics UltraGridView but whatever) to a text file. I
want each row to be in a single line.
I found plenty of tutorials online, but they are only for ASP, and they use
a stringwriter then they call upon System.Web.UI.HtmlTextWriter , and then
Response.write.
I've already got the grid loaded up in a stringbuilder, but how do I export
that stringbuilder to a text file??
here is my code if it will help:
DataSet DSToPrint = new DataSet();
//method returns populated dataset
DSToPrint = myClass.FillDataset();
//make a string builder
StringBuilder str = new StringBuilder();
//fill the string builder with all the rows in the dataset
for (int i = 0; i <= DSToPrint.Tables[0].Rows.Count - 1; i++)
{
for (int j = 0; j <= DSToPrint.Tables[0].Columns.Count - 1; j++)
{
str.Append("[" + DSToPrint.Tables[0].Rows[i][j].ToString() + "] ");
}
str.Append(Environment.NewLine);
}
now what??
thanks