Ser requiere usar System.IO.
private void LeerArchivotxt(object sender, EventArgs e) { OpenFileDialog openFiledialog = new OpenFileDialog(); openFiledialog.Filter = "csv files (*.csv)|*.csv"; openFiledialog.Title = "Export in CSV format"; if (openFiledialog.ShowDialog() == DialogResult.OK) { int counter = 0; string line; System.IO.StreamReader file = new System.IO.StreamReader(openFiledialog.FileName); while((line = file.ReadLine()) != null) { Console.WriteLine (line);//poner aqui lo que necesites que se haga con cada linea counter++;// Contador de lineas } file.Close(); } }