Leer Un Texto

1
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) { } } }

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){

    }}

    }