I want to upload all the txt files from a folder. for uploading txt files to datagrid Iam using the following code.
path = (txtfilelocation.Text);//Folder path
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(path);
foreach (System.IO.FileInfo f in dir.GetFiles("*.TXT"))
{
string[] aa = File.ReadAllLines(f.FullName);
foreach (var item in aa)
{
DataRow dr = dt.NewRow();
char[] delimiters = new char[] { '\t' };
string[] parts = item.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < parts.Length; i++)
{
DataColumn col = new DataColumn(parts[i]);
col.DataType = System.Type.GetType("System.String");
dt.Columns.Add(col);
---
--
When I check in my local mechine it seems working with out error.
but when i try to run the same in a client the following error
System.IO.DirectoryNotFoundException: Could not find a part of the path
please suggest how can I solve this Issue
Thanks In Advance