Anwar Jabbar

Anwar Jabbar

  • NA
  • 35
  • 1.8k

FileNotFoundException unhandled error

Mar 3 2017 5:50 AM
Dear Friends,
 
Kindly assist on the below
I am making program in Visual Studio 2008 C# for Windows CE 6 device (datalogic memor).
Trying to read data from a CSV file using below code
 
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
 
 
private void cmdDataRefresh_Click(object sender, EventArgs e)
{
if (!File.Exists(@"d:\\SampleSale.csv"))
{
Console.WriteLine("{0} not exist.");
}
StreamReader reader = new StreamReader(File.OpenRead(@"SampleSale.csv"));
}
 
 
But i get an error while running the code at the line StreamReader 
 
 
 
 
Can you help on this? how to specify the file with path and why this error comes up?
 
Thanks
 
 
 
 

Answers (8)