private void CreateDT()
{
DataTable dt = new DataTable();
//Adding data To DataTable
dt.Columns.Add("ID");
dt.Columns.Add("Name");
dt.Columns.Add("Address");
dt.Rows.Add(1, "VenkVenkVenkVenkVenkVenkVenkVenkVenkVenkVenkVenkVenkVenkVenkVenkVenkVenkVenkVenk", "chennai");
dt.Rows.Add(2, "Hanu", "London");
dt.Rows.Add(3, "john", "Swiss");
// DataGridView grid = new DataGridView();
int i = 0;
StreamWriter swExtLogFile = new StreamWriter("D:/DTlog2.txt", true);
//StreamWriter sw = null;
// sw = new StreamWriter(submittedFilePath, false);
for (i = 0; i < dt.Columns.Count - 1; i++)
{
swExtLogFile.Write(dt.Columns[i].ColumnName + "\t" +"\t" + " | ");
}
swExtLogFile.Write(dt.Columns[i].ColumnName);
swExtLogFile.WriteLine();
foreach (DataRow row in dt.Rows)
{
object[] array = row.ItemArray;
for (i = 0; i < array.Length - 1; i++)
{
swExtLogFile.Write(array[i].ToString() + "\t" + "\t" + " | ");
}
swExtLogFile.Write(array[i].ToString());
swExtLogFile.WriteLine();
}
swExtLogFile.Close();
}