Hi all,
I am trying to get out put in the folder . The folder is created but the text file is not visible.What is wrong with this code. Here goes the code:
private void savetxt()
{
try
{
//m_stockInfolist is nothing but the listview control name
string[] st = new string[m_StockInfoList.Columns.Count];
DirectoryInfo di = new DirectoryInfo(@"c:\Extraction\");
if (di.Exists == false)
di.Create();
StreamWriter sw = new StreamWriter(@"c:\Extraction\file.txt", false);
sw.AutoFlush = true;
for (int col = 0; col < m_StockInfoList.Columns.Count; col++)
{
sw.Write("\t" + m_StockInfoList.Columns[col].Text.ToString());
}
int rowIndex = 1;
int row = 0;
string st1 = "";
for (row = 0; row < m_StockInfoList.Items.Count; row++)
{
if (rowIndex <= m_StockInfoList.Items.Count) rowIndex++;
st1 = "\n";
for (int col = 0; col < m_StockInfoList.Columns.Count; col++)
{
st1 = st1 + "\t" + "'" + m_StockInfoList.Items[row].SubItems[col].Text.ToString();
}
sw.WriteLine(st1);
}
sw.flush();
sw.Close();
}
{
}
Anyone there to help me out .
Thanks