Illegal characters in path exception is showing with my code

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi all
i am having an error showing illegal characters in path . here is my sample code

public List<string[]> parseCSV(string path)<br/>
{<br/>
List<string[]> parsedData = new List<string[]>(); <br/>
try<br/>
{<br/>
using (StreamReader readFile = new StreamReader(path))<br/>
{<br/>
string line;<br/>
string[] row;<br/>
while ((line = readFile.ReadLine()) != null)<br/>
{<br/>
row = line.Split(,);<br/>
parsedData.Add(row);<br/>
}<br/>
}<br/>
}<br/>
catch (Exception e)<br/>
{<br/>
MessageBox.Show(e.Message);<br/>
}<br/>
<br/>
return parsedData;<br/>
<br/>
}<br/>
<br/>
<br/>
public string path()<br/>
{<br/>
string pth = "F:test1.csv";<br/>
return pth;<br/>
}<br/>
<br/>
private void button1_Click(object sender, EventArgs e)<br/>
{<br/>
parseCSV(path());<br/>
} <hr class="sig MSDN Forum

View the full article
 
Back
Top