Leer Un Texto

Post on 10-Sep-2015

6 views 0 download

description

programacion

Transcript of Leer Un Texto

  • LEER TEXTO

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.IO;

    namespace ejercicio_archivo{

    public partial class Form1 : Form{

    public Form1(){

    InitializeComponent();}

    private void textBox1_TextChanged(object sender, EventArgs e){

    }

    private void button1_Click(object sender, EventArgs e){

    if (openFileDialog1.ShowDialog() == DialogResult.OK){

    StreamReader archivo = new StreamReader(openFileDialog1.FileName);textBox1.Text = openFileDialog1.FileName;while (archivo.Peek() >= 0){

    textBox2.Text += archivo.ReadLine() + "\r\n";}archivo.Close();

    }

    }

    private void textBox2_TextChanged(object sender, EventArgs e){

    }}

    }